(Java) JPopupMenu won't close if I click outside of it
Posted
by Danny King
on Stack Overflow
See other posts from Stack Overflow
or by Danny King
Published on 2010-04-18T12:26:45Z
Indexed on
2010/04/18
12:33 UTC
Read the original article
Hit count: 568
java
Hi all,
I have created a Java Swing app that has no visible main window but which is controlled through its tray icon by right-clicking.
I am using a JPopupMenu for this, but when I click outside of the popup menu (e.g. on another application's window or the desktop) the JPopupMenu does not disappear which is not the expected behaviour.
Originally I was using a popupMenu which did work as expected but this did not allow me to have icons in the menu.
How can I get it to close when I click elsewhere, as expected?
Thanks!
© Stack Overflow or respective owner