import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class ClickMe extends JFrame implements ActionListener
{
public static void main(String[] args)
{
new ClickMe();
}
private JButton button1;
public ClickMe()
{
this.setSize(200,100);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
this.setTitle("I'm Listening!");
JPanel panel1=new JPanel();
button1 = new JButton("Click Me!");
button1.addActionListener(this);
panel1.add(button1);
this.add(panel1);
this.setVisible(true);
}
private int clickCount = 0;
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == button1)
{
clickCount++;
if(clickCount == 1)
button1.setText("I'v been Clicked!");
else
button1.setText("I'v been Clicked!" + clickCount + " times!");
}
}
}
I'm new to java programming. This small program should compile but it doesn't
I'm using jdk1.7.0 version of java on a 64 bit machine. when i try to compile it I get "class, interface or enum expected" error
the attached file is a screen shot of the dos window i tried to compile in
I would appreciate any help anyone could give me in getting this program to work-bclark