• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to exit from jframe?

 
vijay kiranwithvijay
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does my JFrame go away after I choose system close on the window?
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Have a look at JFrame's API
 
Suvidha Agarwal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
U can do it in two ways
1) As suggested above
JFrame f1;
f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

2) You can add a window adapter and overwrite its window closing method with System.exit(0) inside it
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!