这个程序有问题吗?为什么编译不了?我是初学者,请各位大神帮我解决一下吧,谢谢了啊!

图片说明package button;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class ButtonFrameTest {

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    EventQueue.invokeLater(new Runnable()
       {
           public void run()
           {
               JFrame frame=new ButtonFrame();
               frame.setTitle("ButtonFrame");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               frame.setVisible(true);
           }
       });
}

}
class ButtonFrame extends JFrame
{
private JPanel buttonPanel;
private static final int DEFAULT_WIDTH=300;
private static final int DEFAULT_HEIGHT=200;

public ButtonFrame()
{
    setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);

    JButton yellowButton=new JButton("Yellow");
    JButton blueButton=new JButton("Blue");
    JButton redButton=new JButton("Red");

    buttonPanel.add(yellowButton);
    buttonPanel.add(blueButton);
    buttonPanel.add(redButton);

    add(buttonPanel);

    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
{
    private Color backgroundColor;
    public ColorAction(Color c)
    {
        backgroundColor=c;
    }
    public void actionPerformed(ActionEvent event)
    {
        buttonPanel.setBackground(backgroundColor);
    }
}

}

编译没问题,把你的编译错误贴出来

检查你的环境,导入jar包是否完整

代码看起来没有什么问题,你可以检查一下你的编译环境,或是把异常信息发出来,大家帮你看一下