aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Remove menu item when internal frame is closed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Remove menu item when internal frame is closed" Watch "Remove menu item when internal frame is closed" New topic
Author

Remove menu item when internal frame is closed

Sylvia Allen
Greenhorn

Joined: Apr 02, 2001
Posts: 18
I have this app that has a JFrame with a menu, and some JInternalFrames inside that. Each JInternalFrame has its own menuitem on the menu. How can I get the menuitem to go away when its JInternalFrame is closed? I tried to find this information on the Sun tutorial site but couldn't find it. I tried several ways already but nothing has worked. A code snippet would be very much appreciated.
- SA

------------------
Sylvia Allen
sylviaa@screaminet.com


Sylvia Allen<br />sylviaa53@yahoo.com
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Sylvia,
The code below doesn't do exactly what you want. But it might give you the general idea of menuItem add/remove.

Enjoy,
Manfred.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Hi, a way to do this is two ways.
1. Add a InternalFrame Listener and listen for the close event. On that event do myMenu.remove(myMenuItem)
2. Another way would be do disable the close option on the InternalFrame in the upper right corner and create a Close Button somewhere on the InternalFrame. And then add a Listener to the button and do the same as #1 above when the button is pressed but also do a dispose() for the Internal Frame to get rid of it.
Hope that helps

------------------
Happy Coding,
Gregg Bolinger


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remove menu item when internal frame is closed