aspose 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
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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in "Headfirst Java"
 
Similar Threads
Help With HeadFirst Java Chapter 12 page 360
Button's action event in Head first java
code error
Swing graphics problem
javax.awt.event does not exist!!!