Java 类javax.swing.colorchooser.AbstractColorChooserPanel 实例源码

项目:GIFKR    文件:ViewUtils.java   
public static void fixOsxColorChooser(JColorChooser chooser) {

        if(!UIManager.getLookAndFeel().getName().equals("Mac OS X"))
            return;

        AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
        for(JPanel p : panels) {
            if(p!=null) {
                p.setOpaque(false);
                ((JComponent) p.getParent()).setOpaque(false);
                for(Component c : p.getComponents()) {
                    ((JComponent) c).setBorder(null);
                    ((JComponent) c).setOpaque(false);
                }
            }
        }
    }
项目:LogiGSK    文件:JColorChooserGrayScale.java   
public static Color showDialog(Component component, String title,
        Color initial) {
    JColorChooser choose = new JColorChooser(initial);

    JDialog dialog = createDialog(component, title, true, choose, null, null);

    AbstractColorChooserPanel[] panels = choose.getChooserPanels();
    for (AbstractColorChooserPanel accp : panels) {
        choose.removeChooserPanel(accp);
    }
    GrayScaleSwatchChooserPanel grayScaleSwatchChooserPanelFreeStyle = new GrayScaleSwatchChooserPanel();
    GrayScalePanel grayScalePanelFreeStyle = new GrayScalePanel();
    choose.addChooserPanel(grayScaleSwatchChooserPanelFreeStyle);
    choose.addChooserPanel(grayScalePanelFreeStyle);

    dialog.getContentPane().add(choose);
    dialog.pack();
    dialog.setVisible(true);//.show();

    return choose.getColor();
}
项目:jdk8u-jdk    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:jdk8u_jdk    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:javify    文件:JColorChooser.java   
/**
 * This method sets the chooserPanels property for this JColorChooser.
 *
 * @param panels The new set of AbstractColorChooserPanels to use.
 */
public void setChooserPanels(AbstractColorChooserPanel[] panels)
{
  if (panels != chooserPanels)
    {
      if (chooserPanels != null)
        for (int i = 0; i < chooserPanels.length; i++)
          if (chooserPanels[i] != null)
            chooserPanels[i].uninstallChooserPanel(this);

      AbstractColorChooserPanel[] old = chooserPanels;
      chooserPanels = panels;

      if (panels != null)
        for (int i = 0; i < panels.length; i++)
          if (panels[i] != null)
            panels[i].installChooserPanel(this);

      firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
    }
}
项目:jvm-stm    文件:JColorChooser.java   
/**
 * This method sets the chooserPanels property for this JColorChooser.
 *
 * @param panels The new set of AbstractColorChooserPanels to use.
 */
public void setChooserPanels(AbstractColorChooserPanel[] panels)
{
  if (panels != chooserPanels)
    {
      if (chooserPanels != null)
        for (int i = 0; i < chooserPanels.length; i++)
          if (chooserPanels[i] != null)
            chooserPanels[i].uninstallChooserPanel(this);

      AbstractColorChooserPanel[] old = chooserPanels;
      chooserPanels = panels;

      if (panels != null)
        for (int i = 0; i < panels.length; i++)
          if (panels[i] != null)
            panels[i].installChooserPanel(this);

      firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
    }
}
项目:Paint    文件:PaintFrame.java   
private void addColorChooser() {
    // remove unwanted, extra color chooser features like other color
    // options and preview
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    AbstractColorChooserPanel[] newPanels = { panels[0] };
    chooser.setChooserPanels(newPanels);

    // customize preview panel
    JLabel preview = new JLabel("\u25FC\u25FC\u25FC\u25FC\u25FC", JLabel.CENTER);
    preview.setFont(new Font("Serif", Font.BOLD, 18));
    chooser.setPreviewPanel(preview);

    chooser.getSelectionModel().addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            canvas.updateColor(chooser.getColor());
        }
    });

    southPanel.add(chooser, BorderLayout.WEST);
}
项目:AndroidIconEditor    文件:MainUi.java   
private void setColorChooserDialog() {
    jColorChooser.setPreviewPanel(new JPanel());
    AbstractColorChooserPanel[] panels = jColorChooser.getChooserPanels();
    for (AbstractColorChooserPanel p : panels) {
        String displayName = p.getDisplayName();
        switch (displayName.toUpperCase()) {
            case "HSV":
                jColorChooser.removeChooserPanel(p);
                break;
            case "HSL":
                jColorChooser.removeChooserPanel(p);
                break;
            case "CMYK":
                jColorChooser.removeChooserPanel(p);
                break;
            case "SWATCHES":
                jColorChooser.removeChooserPanel(p);
                break;
        }
    }
}
项目:infobip-open-jdk-8    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:jdk8u-dev-jdk    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:rplib    文件:PaintChooser.java   
private JColorChooser createSwatchColorChooser() {
    final JColorChooser chooser = new JColorChooser();

    AbstractColorChooserPanel swatchPanel = chooser.getChooserPanels()[0];
    for (AbstractColorChooserPanel panel : chooser.getChooserPanels()) {
        if (panel != swatchPanel) { // Swatch panel
            chooser.removeChooserPanel(panel);
        }
    }

    chooser.setPreviewPanel(new JPanel());
    chooser.getSelectionModel().addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            setPaint(chooser.getColor());
            hueColorChooser.setColor(chooser.getColor());
            rgbColorChooser.setColor(chooser.getColor());
        }
    });
    return chooser;
}
项目:rplib    文件:PaintChooser.java   
private JColorChooser createHueColorChooser() {
    final JColorChooser chooser = new JColorChooser();

    AbstractColorChooserPanel hsvPanel = chooser.getChooserPanels()[1];

    for (AbstractColorChooserPanel panel : chooser.getChooserPanels()) {
        if (panel != hsvPanel) { // Hue panel
            chooser.removeChooserPanel(panel);
        }
    }

    chooser.setPreviewPanel(new JPanel());
    chooser.getSelectionModel().addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            setPaint(chooser.getColor());
            swatchColorChooser.setColor(chooser.getColor());
            rgbColorChooser.setColor(chooser.getColor());
        }
    });
    return chooser;
}
项目:rplib    文件:PaintChooser.java   
private JColorChooser createRGBColorChooser() {
    final JColorChooser chooser = new JColorChooser();

    AbstractColorChooserPanel rgbPanel;
    if (chooser.getChooserPanels().length > 3) {
        rgbPanel = chooser.getChooserPanels()[3];
    } else {
        rgbPanel = chooser.getChooserPanels()[2];
    }

    for (AbstractColorChooserPanel panel : chooser.getChooserPanels()) {
        if (panel != rgbPanel) { // RGB panel
            chooser.removeChooserPanel(panel);
        }
    }

    chooser.setPreviewPanel(new JPanel());
    chooser.getSelectionModel().addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            setPaint(chooser.getColor());
            swatchColorChooser.setColor(chooser.getColor());
            hueColorChooser.setColor(chooser.getColor());
        }
    });
    return chooser;
}
项目:jdk7-jdk    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:openjdk-source-code-learn    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:OLD-OpenJDK8    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:cn1    文件:JColorChooser.java   
public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel) {
    AbstractColorChooserPanel panelToRemove = null;
    int index = 0;
    for (int i = 0; i < chooserPanels.length; i++) {
        if (panel.equals(chooserPanels[i])) {
            panelToRemove = chooserPanels[i];
            index = i;
            break;
        }
    }
    if (panelToRemove == null) {
        throw new IllegalArgumentException(Messages.getString("swing.0A")); //$NON-NLS-1$
    }
    AbstractColorChooserPanel[] newChooserPanels = new AbstractColorChooserPanel[chooserPanels.length - 1];
    System.arraycopy(chooserPanels, 0, newChooserPanels, 0, index);
    System.arraycopy(chooserPanels, index + 1, newChooserPanels, index,
            newChooserPanels.length - index);
    setChooserPanels(newChooserPanels);
    return panelToRemove;
}
项目:cn1    文件:BasicColorChooserUITest.java   
public void testUninstallDefaultChoosers() throws Exception {
    assertEquals(2, ch.getComponentCount());
    assertNotNull(findComponent(ch, JTabbedPane.class, true));
    assertEquals(3, ((JTabbedPane) findComponent(ch, JTabbedPane.class, true))
            .getTabCount());
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNotNull(findComponent(ch, JTabbedPane.class, true));
    assertEquals(2, ((JTabbedPane) findComponent(ch, JTabbedPane.class, true))
            .getTabCount());
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
    ui.defaultChoosers = new AbstractColorChooserPanel[0];
    ui.uninstallDefaultChoosers();
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
}
项目:JamVM-PH    文件:JColorChooser.java   
/**
 * This method sets the chooserPanels property for this JColorChooser.
 *
 * @param panels The new set of AbstractColorChooserPanels to use.
 */
public void setChooserPanels(AbstractColorChooserPanel[] panels)
{
  if (panels != chooserPanels)
    {
      if (chooserPanels != null)
        for (int i = 0; i < chooserPanels.length; i++)
          if (chooserPanels[i] != null)
            chooserPanels[i].uninstallChooserPanel(this);

      AbstractColorChooserPanel[] old = chooserPanels;
      chooserPanels = panels;

      if (panels != null)
        for (int i = 0; i < panels.length; i++)
          if (panels[i] != null)
            panels[i].installChooserPanel(this);

      firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
    }
}
项目:JAVA_UNIT    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:openjdk-jdk7u-jdk    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:classpath    文件:JColorChooser.java   
/**
 * This method sets the chooserPanels property for this JColorChooser.
 *
 * @param panels The new set of AbstractColorChooserPanels to use.
 */
public void setChooserPanels(AbstractColorChooserPanel[] panels)
{
  if (panels != chooserPanels)
    {
      if (chooserPanels != null)
        for (int i = 0; i < chooserPanels.length; i++)
          if (chooserPanels[i] != null)
            chooserPanels[i].uninstallChooserPanel(this);

      AbstractColorChooserPanel[] old = chooserPanels;
      chooserPanels = panels;

      if (panels != null)
        for (int i = 0; i < panels.length; i++)
          if (panels[i] != null)
            panels[i].installChooserPanel(this);

      firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
    }
}
项目:freeVM    文件:JColorChooser.java   
public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel) {
    AbstractColorChooserPanel panelToRemove = null;
    int index = 0;
    for (int i = 0; i < chooserPanels.length; i++) {
        if (panel.equals(chooserPanels[i])) {
            panelToRemove = chooserPanels[i];
            index = i;
            break;
        }
    }
    if (panelToRemove == null) {
        throw new IllegalArgumentException(Messages.getString("swing.0A")); //$NON-NLS-1$
    }
    AbstractColorChooserPanel[] newChooserPanels = new AbstractColorChooserPanel[chooserPanels.length - 1];
    System.arraycopy(chooserPanels, 0, newChooserPanels, 0, index);
    System.arraycopy(chooserPanels, index + 1, newChooserPanels, index,
            newChooserPanels.length - index);
    setChooserPanels(newChooserPanels);
    return panelToRemove;
}
项目:freeVM    文件:BasicColorChooserUITest.java   
public void testUninstallDefaultChoosers() throws Exception {
    assertEquals(2, ch.getComponentCount());
    assertNotNull(findComponent(ch, JTabbedPane.class, true));
    assertEquals(3, ((JTabbedPane) findComponent(ch, JTabbedPane.class, true))
            .getTabCount());
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNotNull(findComponent(ch, JTabbedPane.class, true));
    assertEquals(2, ((JTabbedPane) findComponent(ch, JTabbedPane.class, true))
            .getTabCount());
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
    ui.defaultChoosers = new AbstractColorChooserPanel[0];
    ui.uninstallDefaultChoosers();
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
}
项目:freeVM    文件:JColorChooser.java   
public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel) {
    AbstractColorChooserPanel panelToRemove = null;
    int index = 0;
    for (int i = 0; i < chooserPanels.length; i++) {
        if (panel.equals(chooserPanels[i])) {
            panelToRemove = chooserPanels[i];
            index = i;
            break;
        }
    }
    if (panelToRemove == null) {
        throw new IllegalArgumentException(Messages.getString("swing.0A")); //$NON-NLS-1$
    }
    AbstractColorChooserPanel[] newChooserPanels = new AbstractColorChooserPanel[chooserPanels.length - 1];
    System.arraycopy(chooserPanels, 0, newChooserPanels, 0, index);
    System.arraycopy(chooserPanels, index + 1, newChooserPanels, index,
            newChooserPanels.length - index);
    setChooserPanels(newChooserPanels);
    return panelToRemove;
}
项目:freeVM    文件:BasicColorChooserUITest.java   
public void testUninstallDefaultChoosers() throws Exception {
    assertEquals(2, ch.getComponentCount());
    assertNotNull(findComponent(ch, JTabbedPane.class, true));
    assertEquals(3, ((JTabbedPane) findComponent(ch, JTabbedPane.class, true))
            .getTabCount());
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNotNull(findComponent(ch, JTabbedPane.class, true));
    assertEquals(2, ((JTabbedPane) findComponent(ch, JTabbedPane.class, true))
            .getTabCount());
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
    ch.removeChooserPanel(ch.getChooserPanels()[0]);
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
    ui.defaultChoosers = new AbstractColorChooserPanel[0];
    ui.uninstallDefaultChoosers();
    assertEquals(2, ch.getComponentCount());
    assertNull(findComponent(ch, JTabbedPane.class, true));
}
项目:openjdk-icedtea7    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:MapAnalyst    文件:ColorButton.java   
/**
 * Creates a new instance of ColorButton. Default color is black, default
 * size of the icon is 16 x 16 pixels. This button is registered with itself
 * for receiving action performed calls.
 */
public ColorButton() {
    this.color = new Color(0, 0, 0);
    this.iconHeight = 16;
    this.iconWidth = 16;
    this.colorChooserTitle = "Choose a Color";

    //Set up the dialog that the button brings up.
    colorChooser = new JColorChooser();

    // replace the ugly and useless preview panel by an empty JPanel
    colorChooser.setPreviewPanel(new JPanel());

    // remove the swatch
    AbstractColorChooserPanel[] choosers = colorChooser.getChooserPanels();
    for (AbstractColorChooserPanel chooser : choosers) {
        String clsName = chooser.getClass().getName();
        if (clsName.equals("javax.swing.colorchooser.DefaultSwatchChooserPanel")) {
            colorChooser.removeChooserPanel(chooser);
        }
    }

    ColorSelectionModel colorSelectionModel = colorChooser.getSelectionModel();
    colorSelectionModel.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent evt) {
            ColorSelectionModel model = (ColorSelectionModel) evt.getSource();
            setColor(model.getSelectedColor());
        }
    });

    this.updateIcon();
}
项目:GIFKR    文件:ViewUtils.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];
        }
    }
    return null;
}
项目:JuggleMasterPro    文件:PreferencesJColorChooser.java   
/**
 * Constructs
 * 
 * @param objPcontrolJFrame
 * @param objPpreferencesJDialog
 * @param bytPcolorPreferenceType
 */
public PreferencesJColorChooser(ControlJFrame objPcontrolJFrame, PreferencesJDialog objPpreferencesJDialog, byte bytPcolorPreferenceType) {

    // Init panels :
    this.objGcontrolJFrame = objPcontrolJFrame;
    this.objGpreferencesJDialog = objPpreferencesJDialog;

    this.bytGcolorPreferenceType = bytPcolorPreferenceType;
    this.setOpaque(true);
    this.setColor(Tools.getPenColor(this.objGpreferencesJDialog.strGstringLocalAA[this.bytGcolorPreferenceType][Constants.bytS_UNCLASS_TEMPORARY_CURRENT]));
    this.setPreviewPanel(new JPanel());
    final AbstractColorChooserPanel[] objLabstractColorChooserPanelA = this.getChooserPanels();
    for (final AbstractColorChooserPanel objLabstractColorChooserPanel : objLabstractColorChooserPanelA) {
        if (!objLabstractColorChooserPanel.getClass().getName().equals("javax.swing.colorchooser.DefaultHSBChooserPanel")) {
            this.removeChooserPanel(objLabstractColorChooserPanel);
        }
    }

    // Actions.doSetFont(this, this.objGcontrolJFrame.getFont());
    // Init listeners :
    this.getSelectionModel().addChangeListener(this);
    this.objGoKActionListener =
                                new PreferencesJColorChooserJDialogListener(this.objGpreferencesJDialog, this, this.bytGcolorPreferenceType, true);
    this.objGcancelActionListener =
                                    new PreferencesJColorChooserJDialogListener(this.objGpreferencesJDialog,
                                                                                this,
                                                                                this.bytGcolorPreferenceType,
                                                                                false);
}
项目:JuggleMasterPro    文件:ColorChooserDropDownJButton.java   
final public void setPopUp() {

        if (this.objGjWindow != null) {
            this.objGjWindow.dispose();
        }
        this.objGjWindow = new JWindow(this.objGcontrolJFrame.getJuggleMasterPro().getFrame());

        switch (this.bytGlocalStringType) {
            case Constants.bytS_STRING_LOCAL_JUGGLER_DAY:
            case Constants.bytS_STRING_LOCAL_SITESWAP_DAY:
            case Constants.bytS_STRING_LOCAL_BACKGROUND_DAY:
                this.objGjColorChooser = new JColorChooser();
                final AbstractColorChooserPanel[] objLabstractColorChooserPanelA = this.objGjColorChooser.getChooserPanels();
                for (final AbstractColorChooserPanel objLabstractColorChooserPanel : objLabstractColorChooserPanelA) {
                    // if
                    // (objLabstractColorChooserPanel.getClass().getName().equals("javax.swing.colorchooser.DefaultHSBChooserPanel"))
                    // {
                    if (objLabstractColorChooserPanel.getClass().getName().equals("javax.swing.colorchooser.DefaultSwatchChooserPanel")) {
                        objLabstractColorChooserPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
                        this.objGjWindow.add(objLabstractColorChooserPanel);
                        break;
                    }
                }
                break;
            case Constants.bytS_STRING_LOCAL_COLORS:
                this.setBallsColorsPopUp();
                //$FALL-THROUGH$
            default:
                this.objGjColorChooser = null;
                break;
        }

        this.objGjWindow.pack();
        this.objGjWindow.setLocation(   (int) Constants.objS_GRAPHICS_TOOLKIT.getScreenSize().getWidth(),
                                        (int) Constants.objS_GRAPHICS_TOOLKIT.getScreenSize().getHeight());
    }
项目:openjdk-jdk10    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    int hsvIndex = 0;
    int panelsLength;
    int finalIndex;
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    panelsLength = panels.length;

    for(int i = 0; i < panelsLength; i++) {
        if(panels[i].getDisplayName().equals("HSV")) {
            hsvIndex = i;
        }
    }
    finalIndex = Math.min(hsvIndex, panelsLength - 1);
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[finalIndex] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:openjdk-jdk10    文件:Test8051548.java   
private static void testColorPanels() throws Exception {
    SwingUtilities.invokeAndWait(() -> createAndShowGUI());

    Robot robot = new Robot();
    robot.setAutoDelay(50);
    robot.waitForIdle();

    for (String[] tabs : TABS) {
        final String tab = tabs[0];
        final String initialValue = tabs[1];

        SwingUtilities.invokeAndWait(() -> {

            colorChooser.setColor(new Color(50, 100, 85));
            JTabbedPane tabbedPane =
                    (JTabbedPane) findComponent(colorChooser, "JTabbedPane");
            int index = tabbedPane.indexOfTab(tab);
            tabbedPane.setSelectedIndex(index);

            AbstractColorChooserPanel colorChooserPanel
                    = (AbstractColorChooserPanel) findComponent(
                            tabbedPane.getComponent(index), "ColorChooserPanel");

            propertyChangeListenerInvoked = false;
            colorChooserPanel.addPropertyChangeListener((e) -> {
                if (AbstractColorChooserPanel.TRANSPARENCY_ENABLED_PROPERTY.
                        equals(e.getPropertyName())) {
                    propertyChangeListenerInvoked = true;
                    if(!(Boolean)e.getOldValue()){
                        throw new RuntimeException("Old color transparency"
                                + " selection property should be true!");
                    }
                    if((Boolean)e.getNewValue()){
                        throw new RuntimeException("New color transparency"
                                + " selection property should be false!");
                    }
                }
            });

            if (!colorChooserPanel.isColorTransparencySelectionEnabled()) {
                throw new RuntimeException("Color transparency selection"
                        + " should be enabled by default");
            }

            JFormattedTextField transparencyTextField = (JFormattedTextField)
                    findTextField(colorChooserPanel, initialValue);

            if (!transparencyTextField.isEnabled()) {
                throw new RuntimeException("Transparency controls are"
                        + " disabled by default!");
            }

            transparencyTextField.setValue(50);

            if(!colorHasAlpha()){
                throw new RuntimeException("Transparency selection should"
                        + " be enabled!");
            }

            colorChooserPanel.setColorTransparencySelectionEnabled(false);

            if (colorChooserPanel.isColorTransparencySelectionEnabled()) {
                throw new RuntimeException("Color transparency selection"
                        + " should be disabled!");
            }

            if(!propertyChangeListenerInvoked){
                throw new RuntimeException("Property change listener is not"
                        + " invoked!");
            }

            if(colorHasAlpha()){
                throw new RuntimeException("Transparency selection should"
                        + " be disabled!");
            }
        });

        robot.waitForIdle();
    }

}
项目:openjdk-jdk10    文件:JColorChooserOperator.java   
/**
 * Maps
 * {@code JColorChooser.addChooserPanel(AbstractColorChooserPanel)}
 * through queue
 */
public void addChooserPanel(final AbstractColorChooserPanel abstractColorChooserPanel) {
    runMapping(new MapVoidAction("addChooserPanel") {
        @Override
        public void map() {
            ((JColorChooser) getSource()).addChooserPanel(abstractColorChooserPanel);
        }
    });
}
项目:openjdk-jdk10    文件:JColorChooserOperator.java   
/**
 * Maps {@code JColorChooser.getChooserPanels()} through queue
 */
public AbstractColorChooserPanel[] getChooserPanels() {
    return ((AbstractColorChooserPanel[]) runMapping(new MapAction<Object>("getChooserPanels") {
        @Override
        public Object map() {
            return ((JColorChooser) getSource()).getChooserPanels();
        }
    }));
}
项目:openjdk-jdk10    文件:JColorChooserOperator.java   
/**
 * Maps
 * {@code JColorChooser.removeChooserPanel(AbstractColorChooserPanel)}
 * through queue
 */
public AbstractColorChooserPanel removeChooserPanel(final AbstractColorChooserPanel abstractColorChooserPanel) {
    return (runMapping(new MapAction<AbstractColorChooserPanel>("removeChooserPanel") {
        @Override
        public AbstractColorChooserPanel map() {
            return ((JColorChooser) getSource()).removeChooserPanel(abstractColorChooserPanel);
        }
    }));
}
项目:openjdk-jdk10    文件:JColorChooserOperator.java   
/**
 * Maps
 * {@code JColorChooser.setChooserPanels(AbstractColorChooserPanel[])}
 * through queue
 */
public void setChooserPanels(final AbstractColorChooserPanel[] abstractColorChooserPanel) {
    runMapping(new MapVoidAction("setChooserPanels") {
        @Override
        public void map() {
            ((JColorChooser) getSource()).setChooserPanels(abstractColorChooserPanel);
        }
    });
}
项目:openjdk9    文件:Test4177735.java   
public static void main(String[] args) throws Exception {
    int hsvIndex = 0;
    int panelsLength;
    int finalIndex;
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    panelsLength = panels.length;

    for(int i = 0; i < panelsLength; i++) {
        if(panels[i].getDisplayName().equals("HSV")) {
            hsvIndex = i;
        }
    }
    finalIndex = Math.min(hsvIndex, panelsLength - 1);
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[finalIndex] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
项目:openjdk9    文件:JColorChooserOperator.java   
/**
 * Maps
 * {@code JColorChooser.addChooserPanel(AbstractColorChooserPanel)}
 * through queue
 */
public void addChooserPanel(final AbstractColorChooserPanel abstractColorChooserPanel) {
    runMapping(new MapVoidAction("addChooserPanel") {
        @Override
        public void map() {
            ((JColorChooser) getSource()).addChooserPanel(abstractColorChooserPanel);
        }
    });
}