Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reopening closed JInternalFrames

 
Con Lu
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic