Okay... as I've probable stated before, I'm in the process of modernizing a old JRE 1.1/AWT application to use JRE 1.3.x+ and Swing. The last major bit I have it to convert the AWT Menu bar to use Swing JMenu items.
The big problem is that the JMenu popups stay showing if you click on another window/application, unlike the AWT menus, and my product manager hates this behavior.
I thought I could kill the popups by adding this WindowListener:
But this prevents the ActionListeners on the MenuItems from working. Anyone got a clue on how to kill the JMenu popups when the menu loses focus, without interfering with the JMenuItems' ActionListeners?
The big problem is that the JMenu popups stay showing if you click on another window/application, unlike the AWT menus, and my product manager hates this behavior.
I thought I could kill the popups by adding this WindowListener:
code:<HR>Code:class MenuCloser extends WindowAdapter {<P> public void windowDeactivated(WindowEvent event) { Object object = event.getSource();<P> if (object == MainWindowLayout.this) { MenuSelectionManager.defaultManager().clearSelectedPath(); } } }
But this prevents the ActionListeners on the MenuItems from working. Anyone got a clue on how to kill the JMenu popups when the menu loses focus, without interfering with the JMenuItems' ActionListeners?