||Java Swing: Menus and Toolbars, Part 4|
|Subject:||right mouse button events|
In Java the right mouse button events implemented as some kind of "secondary importance" events and they even not included in the MouseListener interface. Instead, you should check for isPopupTrigger() of MouseEvent to catch right mouse button events.
And it really works fine for popup menus.
The problem is that when you press on right mouse button you have got both events - the first activated event is the mousePressed and the second one is the popupTrigger == true.
How can I handle this problem - eliminate mousePressed event when I want only popupTrigger event?
In my code I also use the same approach:
rightMousePressed(e) // this is my function