Skip to main content

Help with code- parsing problems!

No replies
mysnsucks
Offline
Joined: 2009-02-13
Points: 0

Hello, I am new to Java and am trying to make a window that has a button that counts the number of times that the button is clicked. I have been following the book Java for Dummies, and am trying to do a little something on my own.

The problem is at the end. My compiler says that I reached the end of file while parsing. I have no idea what that is, but think its something to do with my curly braces. Here is my code:

import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JButton;

class Frame extends JFrame {

public Frame() {
setTitle("iasdfasdf");
setLayout(new FlowLayout());
setDefaultCloseOperation(EXIT_ON_CLOSE);
butt = new Button("Yipee");
setSize(300,100);
setVisible(true);
Butt.addActionListener(this);
}

public class clikcounter implements ActionListener {
public void actionPerformed(ActionEvent butt) {
numClicks++;
text.setText("Button Clicked " + numClicks + " times");
}

class ShowAFrame {

public static void main(String args[]) {
new Frame();

}
}

Also, I might be posting in the wrong forum, but i really didnt know where to post, so sorry if I am. thanks for your help