• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to reopen a JInternalFrame properly?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ):

 
reply
    Bookmark Topic Watch Topic
  • New Topic