Results 1 to 2 of 2
- 01-28-2010, 06:09 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 3
- Rep Power
- 0
button that runs away from the mouse cursor
Hey guys, I need some help.
If you can maybe direct me in the right direction or let me know how to do it, I want to make a button, run away from the mouse cursor basicially. Its connected to my previous post about the button game. I got that to work, but this is the final piece.
- 01-28-2010, 08:00 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
It might help to be precise about "run away".
Your last post talked about the buttons being laid out in a grid. Is the moving button supposed to be on this grid? Is its movement constrained by the grid and/or empty spaces?
In any case you could use a mouse motion listener which will report the position of the mouse as it moves. Use this position and whatever rules constrain the moving button to decide if the button should move and, if it should, move it.
Similar Threads
-
Mouse Listener for mouse floating over object?
By Krooger in forum AWT / SwingReplies: 1Last Post: 11-18-2009, 04:34 AM -
change the mouse cursor - crosshair cursor
By cassysumandak in forum New To JavaReplies: 1Last Post: 09-28-2009, 01:57 AM -
Show image on glasspane while mouse button is down
By zweibieren in forum AWT / SwingReplies: 10Last Post: 09-12-2009, 06:29 AM -
[SOLVED] App runs only in IDE
By hannehomuth in forum Advanced JavaReplies: 4Last Post: 07-15-2009, 06:41 PM -
Hovering mouse over a button and painting
By gtraylo in forum AWT / SwingReplies: 2Last Post: 04-24-2008, 09:33 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks