All pastes #366441 Raw Edit

Anonymous

public java v1 · immutable
#366441 ·published 2007-02-21 18:00 UTC
rendered paste body
import java.awt.*;import java.util.*;import java.applet.*;import java.lang.*;public class Curseur extends Applet implements Runnable{	Thread thread;	Image img;	Graphics pen;	int posx = 0;	int posy = 0;		boolean stop = false;		public void init()	{		Dimension dim = getSize();		setBackground(Color.white);		img = createImage(dim.width, dim.height);		pen = img.getGraphics();	}	public void run()	{		while (!stop)		{			repaint();      	try	      {	      	Thread.sleep(100);		   }		   catch(InterruptedException e) { }		}	}	public void update(Graphics g)	{		paint(g);	}	public boolean mouseEnter(Event evt, int x, int y)	{		stop = false;		thread = new Thread();		thread.start();				return true;	}	public boolean mouseMove(Event evt, int x, int y)	{		posx = x;		posy = y;					return true;	}	public boolean mouseExit(Event evt, int x, int y)	{		stop = true;				return true;	}	public void paint(Graphics g)	{		Dimension dim = getSize();		int w = (int) dim.getWidth();		int h = (int) dim.getHeight();				pen.drawLine(posx,0,posx,h);		pen.drawLine(0,posy,w,posy);		g.drawImage(img,0,0,this);	}}