| Author |
Opening a JFrame
|
colin shuker
Ranch Hand
Joined: Apr 11, 2005
Posts: 712
|
|
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: 1788
|
|
Change the default to hide the frame.
|
 |
colin shuker
Ranch Hand
Joined: Apr 11, 2005
Posts: 712
|
|
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: 1788
|
|
|
Post your SSCCE showing the problem.
|
 |
colin shuker
Ranch Hand
Joined: Apr 11, 2005
Posts: 712
|
|
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: 1788
|
|
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: 712
|
|
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
|
 |
 |
|
|
subject: Opening a JFrame
|
|
|