File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Help JMenu is getting frozen and won't go away Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help JMenu is getting frozen and won Watch "Help JMenu is getting frozen and won New topic

Help JMenu is getting frozen and won't go away

Martha Cofran

Joined: Jan 31, 2001
Posts: 11
I have an applet which spawns a JFrame that includes a JMenuBar with associated pop-up menus. If you pop a menu and then close the window with the X button, the menu is frozen in place and can't be dismissed (although it is active) when the window is resdisplayed.
We're caching our windows, so they don't get destroyed until the entire app is shut down, only hidden and reshown. I also found that we were recreating our menu everytime the window is displayed. I changed that to create the menu only once. Now when I resdisplay the window, I can actually "pick up" the frozen menu by moving the mouse over all menu options and it will get dismissed as normal when I select something or click in the frame.
I saw another article that suggested this might be fixed in JRE1.3, but I tried this and it made no difference. If anyone has seen this, I'd really appreciate the help.
eric moon
Ranch Hand

Joined: Nov 26, 2000
Posts: 133
Have you tried putting code in your window closing method to either hide or close the menu? I think you may have to do that.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>"Those who cast the votes decide nothing. Those who count the<BR>votes decide<BR>everything." <BR> -Joseph Stalin<HR></BLOCKQUOTE>
Martha Cofran

Joined: Jan 31, 2001
Posts: 11
Thanks for you time Eric.
I though this was being done, but, it had actually been put in an ActionListener attached to the JMenuBar listening for hidden/shown events. These had no impact (because the window was alread invisible before the event fired?), but moving the code into the close window method takes care of my problem.
I agree. Here's the link:
subject: Help JMenu is getting frozen and won't go away
It's not a secret anymore!