FileDocCategorySizeDatePackage
ColorPicker3.javaAPI DocExample2038Thu Oct 24 20:14:24 BST 2002None

ColorPicker3

public class ColorPicker3 extends JFrame

Fields Summary
Color
c
Constructors Summary
public ColorPicker3()

    super("JColorChooser Test Frame");
    setSize(200, 100);
    final JButton go = new JButton("Show JColorChoser");
    final Container contentPane = getContentPane();
    go.addActionListener(new ActionListener() {
      final JColorChooser chooser = new JColorChooser();
      boolean first = true;
      public void actionPerformed(ActionEvent e) {
        if (first) {
          first = false;
          GrayScalePanel gsp = new GrayScalePanel();
          chooser.addChooserPanel(gsp);
          chooser.setPreviewPanel(new CustomPane());
        }
        JDialog dialog = JColorChooser.createDialog(ColorPicker3.this, 
            "Demo 3", true,
            chooser, new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                c = chooser.getColor();
              }}, null);
        dialog.setVisible(true);
        contentPane.setBackground(c);
      }
    });
    contentPane.add(go, BorderLayout.SOUTH);
    // addWindowListener(new BasicWindowMonitor());  // 1.1 & 1.2
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  
Methods Summary
public static voidmain(java.lang.String[] args)

    ColorPicker3 cp3 = new ColorPicker3();
    cp3.setVisible(true);