This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes EXIT_ON_CLOSE variable error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 3793
    
    1

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: 4166
    
    3

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: 3793
    
    1

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: 4166
    
    3

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
 
Similar Threads
mmm.. music
JButton with ImageIcon Size Problem
running a class a particular number of times
Reg: Running Swing in Browser
I can't load a file with getResource