import java.applet.Applet; import java.awt.*; //tekstiväljad, nupp import java.awt.event.*; //nupuvajutus public class liivakell1 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 liivakell1(){ addMouseMotionListener(this); } public void paint(Graphics g){ if(ex<200 && ey<200){ int tase=150; int koef1=50; int koef2=250; int x=80; int y=80; g.setColor(Color.blue); g.drawLine(x, y, x+300, y); g.drawLine(x, y, x+150, y+150); g.drawLine(x, y+300, x+300, y+300); g.drawLine(x+150, y+150, x, y+300); g.drawLine(x+300, y, x+150, y+150); g.drawLine(x+150, y+150, x+300, y+300); g.drawLine(x+50, y+50, x+50, y+250); g.drawLine(x+25, y+25, x+25, y+275); g.drawLine(x+250, y+250, x+250, y+50); g.drawLine(x+275, y+275, x+275, y+25); g.drawLine(x+150, y+150, x+150, y+300); g.drawLine(x+150, y+150, x+150, y-1); while(tase>0){ g.drawLine(x+koef1, y+koef1, x+koef2, y+koef1); tase=tase-1; koef1=koef1+1; koef2=koef2-1; } }} public static void main(String argumendid[]) { Frame f=new Frame("Liivakell"); f.add(new liivakell1 ()); f.setSize(500, 500); f.setVisible(true); } }