This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Right Click Menu on a JList  RSS feed

 
Dave Donohoe
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all - can anyone tell me the easiest way to add a Right Click Popup Menu onto the items in a JList?
Thanks,
D
 
ming fan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a mouse listener to the list, and in mouseClicked method detect for right mouse click, then decide whether should pop up the JPopupMenu or not.
Originally posted by Dave Donohoe:

Hi all - can anyone tell me the easiest way to add a Right Click Popup Menu onto the items in a JList?
Thanks,
D

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!