learn java
The moose likes Swing / AWT / SWT and the fly likes JPopupMenu question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPopupMenu question" Watch "JPopupMenu question" New topic

JPopupMenu question

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Is there a way to get a JPopupMenu to expand its menus when clicking instead of when hovering the mouse over the menu?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10694

So you want to expand/collapse the submenus on mouse movements.
You can get the result by subclassing JMenu and adding a mouse listener to detect the mouse entered and mouse exited events. Check out JMenu#fireMenuXXX methods.

Warning:Take this with a grain of salt. I haven't tried it myself.
Also check out http://www.dontclick.it/

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Have you tried LearnNowOnline? http://www.learnnowonline.com/
subject: JPopupMenu question