import java.applet.Applet; import java.awt.event.*; import java.awt.*; import java.util.Vector; public class vann2 extends Applet implements Runnable{ Graphics g; int vann_x1=10, vann_x2=160; int vann_y1=50, vann_y2=100; int vann_pooly=vann_y2-vann_y1/2; int pea_x=10, pea_y=0; boolean pooleli=true; public vann2(){ new Thread(this).start(); } public void paint(Graphics g){ //vann g.drawLine(vann_x1, vann_y1, vann_x2, vann_y1); //äär g.drawLine(vann_x1, vann_y2, vann_x2, vann_y2); //p6hi g.drawLine(vann_x1, vann_y1, vann_x1, vann_y2); //vasak kylg g.drawLine(vann_x2, vann_y1, vann_x2, vann_y2); //parem kylg g.setColor(Color.red); g.drawOval(pea_x, pea_y, 20, 20); //pea g.drawLine(pea_x+10, pea_y+20, pea_x+15, pea_y+40); //selgroog g.drawLine(pea_x+10, pea_y+20, pea_x+20, pea_y+40); //parem kasi g.drawLine(pea_x+10, pea_y+20, pea_x+10, pea_y+40); //vasak kasi g.drawLine(pea_x+15, pea_y+40, pea_x+30, pea_y+70); //1 jalg g.drawLine(pea_x+15, pea_y+40, pea_x+20, pea_y+70); //2 jalg g.setColor(Color.blue); g.drawLine(vann_x1, vann_pooly, vann_x2, vann_pooly); } public void run(){ while(pooleli){ pea_y=pea_y+2; vann_pooly=vann_pooly-1; repaint(); try{Thread.sleep(200);}catch(Exception e){} if(pea_y+70==vann_y2){ pooleli=false; } } } public static void main(String argumendid[]){ Frame f=new Frame("Vann"); f.add(new vann2()); f.setSize(300, 300); f.setVisible(true); } }