Example usage for javax.swing JColorChooser addChooserPanel

List of usage examples for javax.swing JColorChooser addChooserPanel

Introduction

In this page you can find the example usage for javax.swing JColorChooser addChooserPanel.

Prototype

public void addChooserPanel(AbstractColorChooserPanel panel) 

Source Link

Document

Adds a color chooser panel to the color chooser.

Usage

From source file:Main.java

public static void main(String[] argv) {
    JColorChooser chooser = new JColorChooser();
    chooser.addChooserPanel(new MyChooserPanel());
}

From source file:SystemColorChooserPanel.java

public static void main(String[] a) {

    JColorChooser colorChooser = new JColorChooser();
    colorChooser.addChooserPanel(new SystemColorChooserPanel());

    JDialog d = colorChooser.createDialog(null, "", true, colorChooser, null, null);

    d.setVisible(true);/*from w w w .  ja va2s .  co m*/
}

From source file:MainClass.java

public static void main(String[] a) {
    final JColorChooser colorChooser = new JColorChooser();
    SystemColorChooserPanel newChooser = new SystemColorChooserPanel();
    colorChooser.addChooserPanel(newChooser);

    ActionListener okActionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            System.out.println(colorChooser.getColor());
        }/*from  w  ww . j av  a  2  s.  co m*/
    };

    ActionListener cancelActionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            System.out.println("Cancel");
        }
    };

    final JDialog dialog = JColorChooser.createDialog(null, "Change Button Background", true, colorChooser,
            okActionListener, cancelActionListener);
    dialog.setVisible(true);
}