GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Use of JFrame method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Use of JFrame method" Watch "Use of JFrame method" New topic
Author

Use of JFrame method

Rajiv Rai
Ranch Hand

Joined: Jun 14, 2010
Posts: 57


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

Joined: Jun 19, 2010
Posts: 825
    
    5

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.


The quieter you are, the more you are able to hear.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4575
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39087
    
  23
it runs the same way without that call. It is whether it stops that is the question
Rajiv Rai
Ranch Hand

Joined: Jun 14, 2010
Posts: 57
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

Joined: Aug 07, 2007
Posts: 2302
    
  49
though it is hard to make out the difference in eclipse

Why?
Rajiv Rai
Ranch Hand

Joined: Jun 14, 2010
Posts: 57
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of JFrame method