import java.awt.Button; import java.awt.Event; import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Ena extends Frame{ class Psl1 implements ActionListener{ public void actionPerformed(ActionEvent e){ System.exit(0); } } class Psl2 implements ActionListener{ public void actionPerformed(ActionEvent e){ int tmp = Integer.parseInt(desno.getLabel()); tmp = (int)Math.sqrt(tmp); desno.setLabel(""+tmp); } } Button levo, desno; public Ena(){ this.setLayout(new GridLayout(1, 2)); Psl1 p1 = new Psl1(); Psl2 p2 = new Psl2(); levo = new Button("Zapri"); levo.addActionListener(p1); desno = new Button("16"); desno.addActionListener(p2); add(levo); add(desno); setSize(400, 200); } public static void main(String[] args) { // TODO Auto-generated method stub Ena ee = new Ena(); ee.show(); } }