import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class ise extends Applet implements ActionListener{ int nr=100; int mitu=0; int x=0; TextField tf=new TextField("30"); Button bt= new Button("paremale"); Button bt1= new Button("vasakule"); Button bt2= new Button("üles"); Button bt3= new Button("alla"); public ise(){ add(tf); tf.addActionListener(this); add(bt); bt.addActionListener(this); add(bt1); bt1.addActionListener(this); add(bt2); bt2.addActionListener(this); add(bt3); bt3.addActionListener(this); } public void actionPerformed(ActionEvent ev){ x=0; int a=450; int b=250; nr=Integer.parseInt(tf.getText().trim()); mitu=1; Graphics g=this.getGraphics(); if(ev.getSource()==bt){ //ring liigub paremale for(int x=40; x<130; x=x+2){ g.setColor(Color.blue); g.drawOval(a, b, nr, nr); try{Thread.sleep(50);}catch(Exception e){} g.setColor(Color.white); g.drawOval(a, b, nr, nr); a=a+10; //b=b+10; //x=x+1; } } if(ev.getSource()==bt1){ //ring liigub vasakule for(int x=40; x<130; x=x+2){ g.setColor(Color.blue); g.drawOval(a, b, nr, nr); try{Thread.sleep(50);}catch(Exception e){} g.setColor(Color.white); g.drawOval(a, b, nr, nr); a=a-10; //b=b+10; //x=x+1; } } if(ev.getSource()==bt3){ //ring liigub alla for(int x=40; x<115; x=x+2){ g.setColor(Color.blue); g.drawOval(a, b, nr, nr); try{Thread.sleep(50);}catch(Exception e){} g.setColor(Color.white); g.drawOval(a, b, nr, nr); //a=a+10; b=b+10; } } if(ev.getSource()==bt2){ //ring liigub üles for(int x=40; x<90; x=x+2){ g.setColor(Color.blue); g.drawOval(a, b, nr, nr); try{Thread.sleep(50);}catch(Exception e){} g.setColor(Color.white); g.drawOval(a, b, nr, nr); //a=a+10; b=b-10; } } repaint(); } public void paint(Graphics g){ int a=450; int b=250; while(x