Forums Register Login

EXIT_ON_CLOSE variable error

+Pie Number of slices to send: Send



why is it giving error : "Can not find the symbol EXIT_ON_CLOSE variable"?
+Pie Number of slices to send: Send
Because EXIT_ON_CLOSE doesn't exist in the JFrame class. It's in WindowConstants. Look at the Javadocs for the setDefaultCloseOperation method.
+Pie Number of slices to send: Send
 

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.

+Pie Number of slices to send: Send
 

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


Um, JFrame implements WindowConstants.
1
+Pie Number of slices to send: Send
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.
1
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
thank you awesome guys getting tiny error for me. Sorry for inconvenience of coding!
They weren't very bright, but they were very, very big. Ad contrast:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5729 times.
Similar Threads
JButton with ImageIcon Size Problem
I can't load a file with getResource
running a class a particular number of times
Reg: Running Swing in Browser
mmm.. music
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:47:34.