• Post Reply Bookmark Topic Watch Topic
  • New Topic

Frame set visible

 
rizel valiente
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to close a frame, set its visiblity to false
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) setVisible(false) will hide it, you can later setVisible(true) and access the frame
2) dispose() will get rid of it and keep the application open. you will have
to recreate the frame if you want to access it again
3) either setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); or a windowListener
with a windowClosing() containing System.exit(0) will close the application
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!