*
The moose likes Swing / AWT / SWT and the fly likes Reopening closed JInternalFrames Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Reopening closed JInternalFrames" Watch "Reopening closed JInternalFrames" New topic
Author

Reopening closed JInternalFrames

Con Lu
Ranch Hand

Joined: Aug 27, 2002
Posts: 38
Scenario:-
1)Have a JDesktopPane
2)Add 2 JInternalFrames to the JDesktopPane
3)Add the JDesktopPane to the ContentPane
After closing a JInternalFrame you can only reuse it by adding it to a container again, even if you never removed it from the container (refer API notes)" Typically this will be the JDesktopPane that previously held the JInternalFrame
Given the scenario above do I have to add the closed JInternalFrame to the JDesktopPane ?
Do I also have to add the JDesktopPane to the ContentPane again? If so, what happens to the other JInternalFrame in the JDesktopPane that wasn't closed?
Any help much appreciated!
Mike Dahmus
Greenhorn

Joined: Mar 07, 2002
Posts: 29
Originally posted by con lu:
Scenario:-
1)Have a JDesktopPane
2)Add 2 JInternalFrames to the JDesktopPane
3)Add the JDesktopPane to the ContentPane
After closing a JInternalFrame you can only reuse it by adding it to a container again, even if you never removed it from the container (refer API notes)" Typically this will be the JDesktopPane that previously held the JInternalFrame
Given the scenario above do I have to add the closed JInternalFrame to the JDesktopPane ?
Do I also have to add the JDesktopPane to the ContentPane again? If so, what happens to the other JInternalFrame in the JDesktopPane that wasn't closed?
Any help much appreciated!


The best solution to this problem which immediately comes to mind is to change the close behavior of your internal frames to HIDE_ON_CLOSE. See the method JInternalFrame.setDefaultCloseBehavior.


-----Mike Dahmus mike@dahmus.org
 
 
subject: Reopening closed JInternalFrames
 
Similar Threads
can you resolve these questions?Thanks.
Awt vs. Swing error
JInternalFrame TitleBar Modify
A TOUGH question on JInternal Frame
Adding Buttons in JDesktoPane