Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

closing a JFrame  RSS feed

 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got a quick question. I have a MainFrame which opens my ui. Then i have a couple buttons which open smaller frames. Here lies the problem, or lack of knowledge on my part. I cant figure out how to close the smaller opened frames, without closing the entire application itself. What i want is to have a button on one of the smaller frames that sais exit, and when clicked the smaller frame will close, and thats it. Anyone have any suggestions?

Sincerely,

Chris Dancy
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just call dispose() on the frame you want to close. Hey, I made a rhyme.
 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thanks, that worked.

Sincerely,
Chris Dancy
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!