Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to reopen a JInternalFrame properly?  RSS feed

 
Ela Jarecka
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
maybe someone could help me with this... I have the following function ( where claimSelection is a JInternalFrame and desktop is a JDesktopPane ) which can be called from a menu of my application:

Documentation says you're not supposed to use the setClosed( false ) but without it isClosed is always true ( i.e. once a frame has been closed, isClosed is always true, no matter whether it has been reopened in the
meantime ) and I get an exception.
Thanks in advance for your help!
 
Bartek Myszkowski
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
elo,

Why don't You use only visibility of JInternalFrame to change it's state (closed/opened)?
After line 4 where You create new JIF just put this:if the user will click the X to close the JIF it will become hidden only (not disposed). And if You want it to apper on desktop just call claimSelection.setVisible(true);
 
Ela Jarecka
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! Just in case someone ever needs it, here is the corrected code ( isClosed() has been replaced by a call to isVisible() and I'm not adding the frame back to the desktop element anymore ):

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!