Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of JFrame method

 
Rajiv Rai
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


What is the use of the below statement

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

in the above code as it appears to run same way whether i have
that line or not when i run it from eclipse..

Thanks in advance.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the tutorial for more information.
Also check in Eclipse does your program terminates when you omit that line of code, so you'll see the difference.
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method does what it says. Have you read the description in the API?

And since this is a Swing question, I shall move it to the GUIs section.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it runs the same way without that call. It is whether it stops that is the question
 
Rajiv Rai
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just checked in eclipse ,,it stops as explained in API
though it is hard to make out the difference in eclipse

Thanks
 
Tony Docherty
Bartender
Posts: 2957
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
though it is hard to make out the difference in eclipse

Why?
 
Rajiv Rai
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was running the code through eclipse.. When i close the gui window
there was no visual indication of the program being terminated.
Only on looking closely i could find out that there is an indicator of
the program being terminated and that too a small and obscure one

So i said it was tough,,Anyway now i got it

Thanks
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic