Saturday, November 05, 2011

Mouse Trap

So I wrote this little applet. If you move the mouse into the gray panel, then press and hold the left button, you will not be able to move the mouse out of the panel until you release the button. It also leaves a trail, and tracks the location of the mouse cursor while it is being dragged around in the panel.

This uses Java's Robot class, which can take control of the keyboard and mouse. This is a big security risk, so, even though I promise that this applet does nothing malicious (or anything more than I've described for that matter), unless you know and/or trust me, do not give the applet permission to run.



If you don't give it permission, it will still track the mouse when dragged around in the panel, but it won't trap it there.

Later,

0 people have spouted off: