import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class Maja extends Applet{ int x1=150, y1=150, s=0,m=0,o=0,p=0,r=0, y2=50,n=0, y3=50,x4=250,y4=250,x5=250, k=0, l=0; public void paint(Graphics ekraan){ ekraan.setColor(Color.blue); ekraan.drawString("Maja", 20, 30); ekraan.setColor(Color.red); while (x1+k<351){ try{Thread.sleep(10);}catch(Exception e){} ekraan.drawLine(x1, y1, x1+k, y1); k=k+1; } while (y1+l<301){ try{Thread.sleep(10);}catch(Exception e){} ekraan.drawLine(x1+k, y1, x1+k, y1+l); l=l+1; } while ((x1+k)-m>149){ try{Thread.sleep(10);}catch(Exception e){} ekraan.drawLine(x1+k, y1+l, (x1+k)-m, y1+l); m=m+1; } while ((y1+l)-n>149){ try{Thread.sleep(10);}catch(Exception e){} ekraan.drawLine((x1+k)-m, y1+l, (x1+k)-m, (y1+l)-n); n=n+1; } while (x1+o<251){ try{Thread.sleep(10);}catch(Exception e){} ekraan.drawLine(x1, y1, x1+o, y1-p); p=p+1; o=o+1; } while ((x1+o)+r<352){ try{Thread.sleep(10);}catch(Exception e){} ekraan.drawLine(x1+o, y1-p, (x1+o)+r, (y1-p)+s); r=r+1; s=s+1; } try{Thread.sleep(10);}catch(Exception e){} ekraan.drawRect(170, 210, 50, 50); try{Thread.sleep(1000);}catch(Exception e){} ekraan.drawRect(270, 210, 55, 91); ekraan.setColor(Color.blue); try{Thread.sleep(1500);}catch(Exception e){} ekraan.drawString("Maja valmis ", 300, 350); try{Thread.sleep(100000);}catch(Exception e){} } }