Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Right-click menu  RSS feed

 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I want to implement a right-click menu; lets say when you click on JLabel you get click a drop down menu that appears right beside the mouse cursor.

How would I do this? All I found was this (javax.swing.JList) and this javax.swing.ListCellRenderer. The JList doesn't seem to be what I'm looking for because it's a JComponent. Will I have to implement this myself or is there a fancy Java class I can use

I also found this. It seems it's possible to achieve this using a JMenu. Is this true?

Thank-you
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See: Bringing Up a Popup Menu.
 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brilliant! Many thanks Rob
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!