import java.applet.*; import java.awt.*; public class move extends Applet implements Runnable{ int max_x=249; int max_y=249; int mouse_x = 0; int mouse_y = 0; int moving_x = (max_x+1)/2; int moving_y = (max_y+1)/2; int width=20; int height=20; Thread moving=null; public void init() { resize(max_x+1,max_y+1); moving=new Thread(this); } public void start() { moving.start(); } public void run() { while (moving!=null) { try{moving.sleep(1000);} catch(Exception e) {;} moving_x=(int)(Math.random()*(max_x+1)); moving_y=(int)(Math.random()*(max_y+1)); repaint(); } } public void stop() {} public void destroy() {} public void paint(Graphics g) { //A simple border g.drawRect(0,0,max_x,max_y); g.drawLine(0,mouse_y,max_x,mouse_y); g.drawLine(mouse_x,0,mouse_x,max_y); g.drawRect(moving_x,moving_y, width, height); } public boolean mouseDown(Event evt, int x, int y) { mouse_x = x; mouse_y = y; if( moving_x