aspose file tools*
The moose likes Beginning Java and the fly likes EXIT_ON_CLOSE variable error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "EXIT_ON_CLOSE variable error" Watch "EXIT_ON_CLOSE variable error" New topic
Author

EXIT_ON_CLOSE variable error

orgil khatanbaatar
Greenhorn

Joined: Aug 05, 2011
Posts: 17



why is it giving error : "Can not find the symbol EXIT_ON_CLOSE variable"?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4421
    
    8

Because EXIT_ON_CLOSE doesn't exist in the JFrame class. It's in WindowConstants. Look at the Javadocs for the setDefaultCloseOperation method.
orgil khatanbaatar
Greenhorn

Joined: Aug 05, 2011
Posts: 17
Matthew Brown wrote:Because EXIT_ON_CLOSE doesn't exist in the JFrame class. It's in WindowConstants. Look at the Javadocs for the setDefaultCloseOperation method.


No fair. but other codes worked fine so far. I will give an example.

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Matthew Brown wrote:Because EXIT_ON_CLOSE doesn't exist in the JFrame class. It's in WindowConstants.

Um, JFrame implements WindowConstants.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4421
    
    8

Good point . Didn't think that through, and was looking for a simple answer. In that case it's a little strange...

Ah, got it. It should be JFrame.EXIT_ON_CLOSE, not JFrame.EXIT_ON_CL0SE. Spot the difference? Convert it to lower case and it's more obvious.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

orgil , your code doesn't follow the coding conventions and is extremely difficult to read. It's in your own interest to make the code easily readable, as that will get you more readers and quicker/better responses.

You have a typo in EXIT_ON_CL0SE. Look carefully at these two characters: O 0 -- see the difference?

Here's your code with the typo corrected and with class names and indents that conform to convention.
orgil khatanbaatar
Greenhorn

Joined: Aug 05, 2011
Posts: 17
thank you awesome guys getting tiny error for me. Sorry for inconvenience of coding!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EXIT_ON_CLOSE variable error