• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Other SWT Listeners > Working with the MouseMoveListener

14.5. Working with the MouseMoveListener

The MouseMoveListener responds to events caused when the mouse is moved into, across, or away from a widget. It has only one method—mouseMove(). The most common use for the MouseMoveListener used to be to provide tool-tip text for users, but that functionality is now encapsulated in the widget classes. MouseMove( ) can be used to create a simple game.

14.5.1. How do I do that?

A good example that demonstrates MouseMoveListener is the creation of a simple game consisting of a Shell with a single button that displays "Click Me" text. When the user moves the mouse over the button to click, the button is repositioned away from the mouse, making it impossible to click. Example 14-3 does exactly that.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint