How to make a popup menu added to a JtextField to be invisible when the JTextField's focus is lost?
I have added to a JTextField a JPopupMenu. Unfortunatelly, when i change the focus from JTextField, or when i "minimize"开发者_StackOverflow社区 the window, the JPopupMenu still is visible. I need to make it invisible if JTextField is loosing the focus. How can i do this?
You can register a focus listener with the text field. The listener's focusLost() method should hide the menu.
精彩评论