| Author |
JFrame
|
Jysh Reey
Greenhorn
Joined: Oct 10, 2011
Posts: 16
|
|
I have designed a Java program using swing , such that while pressing a button in the main window , a JFrame window appears. Actually while closing the JFrame window, i want it alone to be closed. But while closing the JFrame window my main window also gets closed. How can i avoid this?
This is my coding.
|
 |
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1791
|
|
while pressing a button in the main window , a JFrame window appears. Actually while closing the JFrame window, i want it alone to be closed.
Secondary windows should be JDialogs, not JFrames. The default behaviour for a JDialog is DISPOSE_ON_CLOSE, which will only close the dialog and not the parent JFrame.
|
 |
Jysh Reey
Greenhorn
Joined: Oct 10, 2011
Posts: 16
|
|
Thank you for the response . But made JFrame to close itself alone..
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
|
Rob C has pointed out the real error; you ought to correct that.
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3795
|
|
|
Look at line 220. What are you telling the program to do there?
|
 |
 |
|
|
subject: JFrame
|
|
|