Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

windowlistener

 
Sunita Vontel
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody please explain why when I click on the x button in the top right corner the window is not exiting why??

 
Sandeep Potnis
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sunita,
You need to order the frame to get outta there, you can't just hint at it.
Try adding System.exit(0); to your windowClosing() method.

hth,
Sandeep
 
srikrish
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sunita,
These are the modifications that you need to do to get what you are looking for:
1. Change WindowClosing method name to windowClosing.
2. Check that you are closing all the braces for the inner class correctly.
3. Add System.exit(0) statement after the println statement in your windowClosing method.
That should make the code work. Let me know if you run into any problems.
Srikrish.
 
Sunita Vontel
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u so much sandeep and srikrish
It worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic