ActionListener你要不用匿名类,要不用个内部类,不要让你的JFrame的子类自己实现,然后把自己作为监听器加给自己。这样应该会有问题的。

解决方案 »

  1.   

    public class ColorTest extends JFrame implements ActionListener
    {
    ...
    }
      

  2.   

    你没实作ActionListener接口,怎么可以在本类里btnSelColor.addActionListener(this);
    avtom(avtom) 已经告诉你这个类该怎么申明了
      

  3.   

    avtom(avtom) 告诉我的我已经解决了,但是窗体的背景色为什么不会随着颜色选择器所选择的颜色而改变呢/
      

  4.   

    试试this.getContentPane().setBackground(color);