开发者

How to make a popup menu added to a JtextField to be invisible when the JTextField's focus is lost?

开发者 https://www.devze.com 2022-12-14 11:20 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消