wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Opening a JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Opening a JFrame" Watch "Opening a JFrame" New topic
Author

Opening a JFrame

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Hi, if I have a JFrame which has just been closed, using the X button at the top.

Then this JFrame object is not null and it is not visible, but when I call .setVisible(true),
it still does not appear.

Can anyone help?

Thanks
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2157
    
    7


Change the default to hide the frame.
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
I tried that, but how do I reopen it, don't want to instantiate it again.

Thanks
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2157
    
    7
Post your SSCCE showing the problem.
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Heres sample code



When we just keep pressing the button, it updates the JFrame as expected.
But when the JFrame is closed, it is not null, and calling reset does not display it.

Can anyone get the frame to display if it is closed with the X, thanks
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2157
    
    7
but when I call .setVisible(true), it still does not appear.


I don't see where you invoke setVisible(true) again.
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Oh.


I put

if 'not visible', make visible, but missed off the not ( ! )

Which is why it didn't do that, and remained invisible

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening a JFrame
 
Similar Threads
Open a form
JFrame ?!!!
Open window from JApplet
Call JFrame From JSP
EXIT_ON_CLOSE