设置Button的颜色?
redButton.setBackground(Color.blue);

解决方案 »

  1.   

    是不是这样:?                
    public void actionPerformed(ActionEvent event)
                    {
                            ButtonPanel.this.setBackground(backgroundColor);
                            Component[] buttonArray=ButtonPanel.this.getComponents();
                            for(int i=0;i<buttonArray.length;i++)
                              ((JButton)buttonArray[i]).setBackground(Color.lightGray);
                            JButton button=(JButton)event.getSource();
                            button.setBackground(backgroundColor);
                            repaint();
                    }