import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
class Win extends JFrame implements ActionListener{
JButton jButton1;
   public Win(){
     setLayout(null);
     setTitle("颜色对话框");
     jButton1 = new JButton("打开颜色对话框");
     jButton1.setBounds(32, 45, 130, 34);
     jButton1.addActionListener(this);
     add(jButton1);
     setBounds(200, 200, 200, 150);
     validate();
     setVisible(true);
  }
  public void actionPerformed(ActionEvent e){
 Color newColor = JColorChooser.showDialog(this, "调色板",jButton1.getBackground());
       jButton1.setBackground(newColor);
   }
}
class ColorshowDialog_Test_jButton1_actionAdapter{
public static void main(String args[]){
        Win ta = new Win();
   }
}

