| Author |
How to make JPopupMenu invisible?
|
Andrei Mura
Greenhorn
Joined: Nov 26, 2009
Posts: 18
|
|
I have added to a JTextField a JPopupMenu.
Unfortunatelly, when i change the focus from JTextField, or when i "minimize" the window, the JPopupMenu still is visible.
I need to make it invisible if JTextField is loosing the focus.
How can i do this?
|
 |
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1808
|
|
|
I guess you can add a FocusListener to the text field. When the focusLost() event is fired you get the source which will be the text field and then get the parent which should be the popup menu which you can then hide manually.
|
 |
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1808
|
|
Cross post: http://stackoverflow.com/questions/1920787/how-to-make-a-popup-menu-added-to-a-jtextfield-to-be-invisible-when-the-jtextfiel
Good to know I wasted my time answering a question that has already been answered. That won't happen again.
ignoreList++
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
What Rob was referring to is http://faq.javaranch.com/java/BeForthrightWhenCrossPostingToOtherSites
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: How to make JPopupMenu invisible?
|
|
|