import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class jagamine extends Applet implements ActionListener{ int nr1=100, nr2=100; int nr3=nr1+nr2; TextField tf1=new TextField("100"); TextField tf2=new TextField("100"); TextField tf3=new TextField("100"); public jagamine(){ add(tf1); add(tf2); add(tf3); tf2.addActionListener(this); } public void actionPerformed(ActionEvent e){ nr1=Integer.parseInt(tf1.getText().trim()); nr2=Integer.parseInt(tf2.getText().trim()); if (nr2==0){ tf3.setText("pole vőimalik jagada"); } else{ double nr3=nr1*1.0/nr2; tf3.setText(nr3+""); } repaint(); } public void paint(Graphics g){ g.setColor(Color.green); g.drawString(nr1+"", 100, 100); g.setColor(Color.blue); g.drawString(nr2+"", 200, 100); } public static void main(String argumendid[]){ Frame f=new Frame("Jagamine"); f.setSize(300, 300); f.add(new jagamine()); f.setVisible(true); } }