Here I have a program and I'm getting the following error
ControlPanel is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
public class ControlPanel extends JPanel implements ActionListener
^
I don't fully seem to understand how the best way is to overcome this?
import java.awt.*;
import javax.swing.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
public class ControlPanel extends JPanel implements ActionListener
{
ControlPanel model;
Connect4Model m;
int newCol;
int newRow;
JButton resetButton;
JRadioButton twoPlayerButton;
JRadioButton autoRedButton;
JRadioButton autoYellowButton;
JTextField numRows;
JTextField numCols;
public ControlPanel()
{
resetButton = new JButton("Reset Board");
add(resetButton);
resetButton.addActionListener(this);
twoPlayerButton = new JRadioButton("Two Player Game");
twoPlayerButton.addActionListener(this);
add(twoPlayerButton);
twoPlayerButton.setSelected(true);
autoRedButton = new JRadioButton("Red Button");
autoRedButton.addActionListener(this);
add(autoRedButton);
autoYellowButton = new JRadioButton("Yellow Button");
autoYellowButton.addActionListener(this);
add(autoYellowButton);
ButtonGroup group = new ButtonGroup();
group.add(twoPlayerButton);
ButtonGroup group2 = new ButtonGroup();
group.add(autoRedButton);
ButtonGroup group3 = new ButtonGroup();
group.add(autoYellowButton);
numRows = new JTextField(4);
add(numRows);
numRows.addActionListener(this);
numRows.setText("9");
newCol = Integer.parseInt(numRows.getText());
numCols = new JTextField(4);
add(numCols);
numCols.addActionListener(this);
numCols.setText("7");
newRow = Integer.parseInt(numCols.getText());
// model.reset(newCol, newRow);
// canvas.repaint();
}
}