| View previous topic :: View next topic |
| Author |
Message |
Shirley Kidman
Joined: 21 Jun 2006 Posts: 30
|
| How do I close a Jframe from inside a JFrame? |
| |
|
|
|
|
jomanda
Joined: 19 May 2006 Posts: 70 Location: Germany
|
this.setVisible(false);
this.dispose(); |
| |
|
|
Shirley Kidman
Joined: 21 Jun 2006 Posts: 30
|
| that just makes the contents of the JFrame disappear |
| |
|
|
jomanda
Joined: 19 May 2006 Posts: 70 Location: Germany
|
System.exit(0);
Or send a WM_CLOSE message to the window.
Lots of ways. Define "close". |
| |
|
|
Shirley Kidman
Joined: 21 Jun 2006 Posts: 30
|
I want the window to not be seen anymore
If I system.exit(0) everything dies... |
| |
|
|
jomanda
Joined: 19 May 2006 Posts: 70 Location: Germany
|
| I believe there's an event handler built into the JFrame for closing as well. |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| SetVisible(false) |
| |
|
|
Shirley Kidman
Joined: 21 Jun 2006 Posts: 30
|
just makes contents go away |
| |
|
|
jomanda
Joined: 19 May 2006 Posts: 70 Location: Germany
|
| DEFINE "CLOSE". |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| It gets GC'd eventually |
| |
|
|
Shirley Kidman
Joined: 21 Jun 2006 Posts: 30
|
not visible
Just tried it...
Doesn't work
Ah, I figured it out...
For some reason it was hanging |
| |
|
|
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| Shirley Kidman, get a stack dump on the console C-\ or C-break |
| |
|
|
Shirley Kidman
Joined: 21 Jun 2006 Posts: 30
|
Ah I found it...
Thanks guys |
| |
|
|
|