• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to close a JMenu without clicking outside it?

 
rohit sen
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

A Jmenu automatically collapses, if we click anywhere outside it. Is there a way to replicate this action without clicking?

I tried menu.setSelected(false). This un-selects the menu but it still remains open.

I tried this ans still the menu and menu item is un-selected but they remain open


Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try setting the menu popup's visibility to false
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
rohit sen
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl, that works! Thanks a lot!

Thanks Michael for the tip. I would have tried to to do it that way as the last option.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!