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

Chapter 14. Other SWT Listeners > Working with the MouseEvent Class

14.3. Working with the MouseEvent Class

The MouseEvent class encapsulates a couple of fields other than the x and y coordinates of the mouse to assist in determining exactly what user action has caused the event. If you run our example again, you will notice that it does not differentiate between left-button and right-button clicks, but treats both the same. It is usually advisable to distinguish between a left-button click and a right-button click.

14.3.1. How do I do that?

The following code limits the action taken to left-button clicks only:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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