import java.awt.*; import java.applet.*; import java.awt.event.*; public class liiv extends Applet implements MouseMotionListener{ int ex, ey; public void mouseDragged(MouseEvent e){ ex=e.getX(); ey=e.getY(); repaint(); } public void mouseMoved(MouseEvent e){} public liiv(){ addMouseMotionListener(this); } public void paint(Graphics g){ if(ex<250 && ey<250){ int tase=90; int koef1=10; int koef2=190; int vkoef1=10; int vkoef2=190; int atase=90; int vtase=0; int akoef1=0; int akoef2=200; int x=150; int y=150; g.setColor(Color.black); g.drawLine(x, y, x+200, y); g.drawLine(x, y, x+100, y+100); g.drawLine(x+200, y, x+100, y+100); g.drawLine(x+100, y+100, x, y+200); g.drawLine(x+100, y+100, x+200, y+200); g.drawLine(x, y+200, x+200, y+200); g.drawLine(x, y-25, x, y+225); g.drawLine(x+200, y-25, x+200, y+225); g.drawLine(x+100, y+100, x+100, y+200); while(tase>0){ g.drawLine(x+koef1, y+koef1, x+koef2, y+koef1); tase=tase-1; koef1=koef1+1; koef2=koef2-1; } try{ while(vtase<90){ g.setColor(Color.white); g.drawLine(x+vkoef1, y+vkoef1, x+vkoef2, y+vkoef1); g.setColor(Color.black); g.drawLine(x+akoef1, y+akoef2, x+akoef2, y+akoef2); Thread.sleep(700); vtase=vtase+1; vkoef1=vkoef1+1; vkoef2=vkoef2-1; akoef1=akoef1+1; akoef2=akoef2-1; atase=atase+1; } g.setColor(Color.white); g.drawLine(x+100, y+100, x+100, y+10); }catch(Exception ex){} } if(ex>250 && ey<250){ int x=150; int y=150; g.setColor(Color.black); g.drawLine(x, y, x, y+200); g.drawLine(x+100, y+100, x, y); g.drawLine(x+100, y+100, x+200, y); g.drawLine(x+100, y+100, x, y+200); g.drawLine(x+100, y+100, x+200, y+200); g.drawLine(x+200, y, x+200, y+200); g.drawLine(x-25, y, x+225, y); g.drawLine(x-25, y+200, x+225, y+200); } if(ex>250 && ey>250){ int x=150; int y=150; g.setColor(Color.black); g.drawLine(x, y, x+200, y); g.drawLine(x, y, x+100, y+100); g.drawLine(x+200, y, x+100, y+100); g.drawLine(x+100, y+100, x, y+200); g.drawLine(x+100, y+100, x+200, y+200); g.drawLine(x, y+200, x+200, y+200); g.drawLine(x, y-25, x, y+225); g.drawLine(x+200, y-25, x+200, y+225); } if(ex<250 && ey>250){ int x=150; int y=150; g.setColor(Color.black); g.drawLine(x, y, x, y+200); g.drawLine(x+100, y+100, x, y); g.drawLine(x+100, y+100, x+200, y); g.drawLine(x+100, y+100, x, y+200); g.drawLine(x+100, y+100, x+200, y+200); g.drawLine(x+200, y, x+200, y+200); g.drawLine(x-25, y, x+225, y); g.drawLine(x-25, y+200, x+225, y+200); } } public static void main(String argumendid[]) { Frame f=new Frame("Liivakell"); f.add(new liiv ()); f.setSize(500, 500); f.setVisible(true); } }