Example usage for javax.swing JColorChooser getChooserPanels

List of usage examples for javax.swing JColorChooser getChooserPanels

Introduction

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

Prototype

public AbstractColorChooserPanel[] getChooserPanels() 

Source Link

Document

Returns the specified color panels.

Usage

From source file:Main.java

public static void main(String[] argv) {
    JColorChooser chooser = new JColorChooser();
    int numPanels = chooser.getChooserPanels().length;
    AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[numPanels];
    newPanels[0] = findPanel(chooser, "javax.swing.colorchooser.DefaultHSBChooserPanel");
    newPanels[1] = findPanel(chooser, "javax.swing.colorchooser.DefaultRGBChooserPanel");
    newPanels[2] = findPanel(chooser, "javax.swing.colorchooser.DefaultSwatchChooserPanel");
    chooser.setChooserPanels(newPanels);
}

From source file:Main.java

public static void main(String[] argv) {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] oldPanels = chooser.getChooserPanels();
    for (int i = 0; i < oldPanels.length; i++) {
        String clsName = oldPanels[i].getClass().getName();
        if (clsName.equals("javax.swing.colorchooser.DefaultSwatchChooserPanel")) {
            chooser.removeChooserPanel(oldPanels[i]);
        } else if (clsName.equals("javax.swing.colorchooser.DefaultRGBChooserPanel")) {
            chooser.removeChooserPanel(oldPanels[i]);
        } else if (clsName.equals("javax.swing.colorchooser.DefaultHSBChooserPanel")) {
            chooser.removeChooserPanel(oldPanels[i]);
        }/*from w w  w .  j  a v a2 s .  c o  m*/
    }
}

From source file:Main.java

public static AbstractColorChooserPanel findPanel(JColorChooser chooser, String name) {
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    for (int i = 0; i < panels.length; i++) {
        String clsName = panels[i].getClass().getName();
        if (clsName.equals(name)) {
            return panels[i];
        }//from   w  w  w .j  a v a 2 s.com
    }
    return null;
}

From source file:Main.java

public static AbstractColorChooserPanel findPanel(JColorChooser chooser, String name) {
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();

    for (int i = 0; i < panels.length; i++) {
        String clsName = panels[i].getClass().getName();

        if (clsName.equals(name)) {
            return panels[i];
        }// w ww.j  a  v  a 2s  . c om
    }
    return null;
}