File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Error in Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Error in "Headfirst Java"" Watch "Error in "Headfirst Java"" New topic
Author

Error in "Headfirst Java"

George Sarbu
Greenhorn

Joined: Mar 08, 2009
Posts: 6

Hello! When I try to compile a code from the great book "Head First Java",chapter 12(about GUI), i got an error.
The code is:

import javax.swing.*;
import java.awt.event.*;

public class SimpleGui1B implements ActionListener {


public static void main(String[] args) {

SimpleGui1B gui=new SimpleGui1B();
gui.go();
}

public void go() {

JFrame frame=new JFrame();

JButton buton=new JButton("click");

buton.addActionListener(this);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().add(buton);



frame.setSize(400, 300);

frame.setVisible(true);
}

public void actionPerformed(ActionEvent event) {
buton.setText("I've been clicked");
}


}

Error:
cannot find symbol
symbol:variable buton
location: class SimpleGui1B
buton,setText("I've been clicked")
^
1 error


Please help me !!!
xiss burg
Greenhorn

Joined: Mar 04, 2009
Posts: 3

 
jQuery in Action, 2nd edition
 
subject: Error in "Headfirst Java"