hi there
I'm working my way through the head first book. On page 355 there is a "building your first GUI" section. When I copy the code on the page into a text editor, save as a
java file, and try and compile it from the command prompt I get the following message;
C:\Program Files\Java\javac SimpleGui1.java
SimpleGui1.java:9: cannot find symbol
symbol : variable EXIT_ON_CLOSE
location: class javax.swing.JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1 error
I have checked and double checked my code, which was typed directly from the book. What am I doing wrong. Any help much appreciated! Original code below:
import javax.swing.*;
public class SimpleGui1 {
public static void main (
String[] args) {
JFrame frame = new JFrame();
JButton button = new JButton("click me");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_ClOSE);
frame.getContentPane().add(button);
frame.setSize(300,300);
frame.setVisible(true);
}
}