import java.awt.*; import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class Liivakell extends Applet{ int i, j; int a=1; int b=140; int c=60; int d=60; int e=140; int k=132; public void paint(Graphics g){ g.setColor(Color.black); g.drawLine(60, 48, 140, 48); //joonistab liivakella g.drawLine(60, 48, 99, 90); g.drawLine(140, 48, 101, 90); g.drawLine(99, 90, 60, 132); g.drawLine(101, 90, 140, 132); g.drawLine(60, 132, 140, 132); for(i=61;i<139;i++){ g.setColor(Color.gray); g.drawLine(i+a, 48, 100, 88); } for(j=46;j<90;j++){ b--; c++; try{Thread.sleep(1500);}catch(Exception e){} g.setColor(Color.white); g.drawLine(c, j, b, j); d++; e--; if(k>88){ k--; } g.setColor(Color.gray); g.drawLine(d, k, e, k); g.drawLine(100, 90, 100, 131); } } public static void main(String argumendid[]){ Frame f=new Frame("Liivakell"); f.add(new Liivakell()); f.setSize(250, 250); f.setVisible(true); } }