This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to make right click ?  RSS feed

 
ayman elgharabawy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to make action using right click or press.how can in mousePressed() recognize the right mouse button?
waiting fo reply ..
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two ways...

the isMetaDown() method of InputEvent is the preferred way because you don't have to worry how many buttons the user's mouse has.

there is also the getButton() method of MouseEvent to get the specific mouse button that was pressed.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And don't forget SwingUtilities.isRightMouseButton()
 
ayman elgharabawy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THANKS EVERYBODY..many thanks..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!