• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFrame

 
Jysh Reey
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2566
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the response . But made JFrame to close itself alone..
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob C has pointed out the real error; you ought to correct that.
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at line 220. What are you telling the program to do there?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic