ERROR: class' or 'interface' expected
843789Aug 13 2009 — edited Aug 14 2009Hello, I'm new to Java. I'm having trouble figuring out this 1 error in my code. Need Help Plzzzzzz....
java:81: 'class' or 'interface' expected
public void actionPerformed(ActionEvent e)
import javax.swing.JOptionPane;
import java.awt.*;
import java.awt.event.*;
public class Checkerboard extends Frame implements ActionListener
{
//declare variables
int start, stop, step;
Panel boardPanel = new Panel();
TextArea boardDisplay [] = new TextArea[16];
Panel buttonPanel = new Panel();
Button goButton = new Button ("Go");
Button clearButton = new Button("Clear");
Panel inputPanel = new Panel();
Label startLabel = new Label ("Start");
TextField startField = new TextField();
Label stopLabel = new Label ("Stop");
TextField stopField = new TextField();
Label stepLabel = new Label ("Step");
TextField stepField = new TextField();
public Checkerboard()
{
this.setLayout(new BorderLayout());
boardPanel.setLayout(new GridLayout (4, 4, 2, 3));
inputPanel.setLayout(new FlowLayout());
buttonPanel.setLayout(new FlowLayout());
for (int i=0; i<16; i++)
{
boardDisplay = new TextArea(null,3,5,3);
if (i<16)
boardDisplay[i].getText();
else
boardDisplay[i].setEditable(false);
boardDisplay[i].setBackground(Color.white);
boardPanel.add(boardDisplay[i]);
}
//add components to the button
buttonPanel.add(goButton);
//add components to input panel
inputPanel.add(startField);
inputPanel.add(stopField);
inputPanel.add(stepField);
inputPanel.add(startLabel);
inputPanel.add(stopLabel);
inputPanel.add(stepLabel);
//add panels to frame
add(buttonPanel, BorderLayout.SOUTH);
add(inputPanel, BorderLayout.CENTER);
add(boardPanel, BorderLayout.NORTH);
goButton.addActionListener(this);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}//end Checkerboard frame
}
public void actionPerformed(ActionEvent e)
{
String arg = e.getActionCommand();
try
{
if (arg == "GO")
{
start=Integer.parseInt(startTF.getText());
stop=Integer.parseInt(stopTF.getText());
step=Integer.parseInt(stepTF.getText());
for(int i=0;<textArray.length;i++)
textArray[i].setBackground(Color.blue);
for(int i=start;<textArray.length;i+=step)
textArray[i].setBackground(Color.yellow);
}
catch(Exception x)
{
JOptionPane.showMessageDialog(null,"Data Entry Error","Error",JOptionPane.INFORMATION_MESSAGE);
arg = "Clear")
[
startTF.setText("");
stopTF.setText("");
stepTF.setText("");
for(int i=0;<textArray.length;i++)
textArray[i].setBackground(Color.white);
}
}//end actionPerformed
public static void main(String[]args)
{
Checkerboard f = new Checkerboard();
f.setBounds(50,100,300,300);
f.setTitle("Checkerboard Array");
f.setVisible(true);
}//end main method
}//end Checkerboard class