Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

For windows and linux I am able to detect right click. But for mac I donot know how to detect right-click.

How to write java program to detect right click for Mac OS

Thanks Sunil KUmar Sahoo

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
187 views
Welcome To Ask or Share your Answers For Others

1 Answer

Instead of using MouseEvent.BUTTON3, a bettter self docummenting approach is to use

if (SwingUtilities.isRightMouseButton(event))
   // do something

Also, if you are using this code to display a popup menu, then you should not be using this approach since each OS has different key strokes to inovoke the popup menu. Read the section from the Swing tutorial on Bringing Up a Popup Menu.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...