[求助]菜鸟的小白问题
以下是core java上的一个关于事件处理的小程序,敲上去以后有两个错误怎么也看不出来。。本人初学java,望诸位高手指点。。
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class ButtonPanel extends JPanel
{
public ButtonPanel()
{
JButton yellowButton=new JButton("Yellow");
JButton blueButton=new JButton("Blue");
JButton redButton=new JButton("Red");
add(yellowButton);
add(blueButton);
add(redButton);
ColorAction yellowAction=new ColorAction(Color.YELLOW);
ColorAction blueAction=new ColorAction(Color.BLUE);
ColorAction redAction=new ColorAction(Color.RED);
yellowButton.addActionListener(yellowAction);
blueButton.addActionListener(blueAction);
redButton.addActionListener(redAction);
}
private class ColorAction implements ActionListener
{
public ColorAction(Color c)
{
backgroundColor=c;
}
31 public void actionPerformed(ActionEvent event);
{
33 setBackground(backgroundColor);
}
private Color backgroundColor;
};
}
class ButtonFrame extends JFrame
{
public ButtonFrame()
{
setTitle("Button");
setLocation(WIDTH,HEIGHT);
setSize(WIDTH,HEIGHT);
ButtonPanel panel=new ButtonPanel();
Container pane=getContentPane();
pane.add(panel);
}
private final int WIDTH=300;
private final int HEIGHT=200;
}
public class MyMain
{
public static void main(String[] args)
{
ButtonFrame myFrame=new ButtonFrame();
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.show();
}
}
错误提示
31 missing method body,or declare abstract
33 illegal forward reference