Package javax.swing

Examples of javax.swing.JColorChooser$AccessibleJColorChooser


  public Component getCustomEditor()
  {
    if (colorChooser == null)
    {
      colorChooser = new JColorChooser();
      colorChooser.setColor(value);
      colorChooser.getSelectionModel().addChangeListener(new ColorSelectionChangeListener());
    }
    return colorChooser;
  }
View Full Code Here


    tableModel = new PaintComponentTableModel();
//    tableModel.addComponent(new JButton ("A button"));
//    tableModel.addComponent(new JLabel ("A Label"));
//    tableModel.addComponent(new JCheckBox ("A CheckBox"));
    tableModel.addComponent(new JFileChooser());
    tableModel.addComponent(new JColorChooser());
  }
View Full Code Here

    {
      tableModel.addComponent(new JButton("A button"));
      tableModel.addComponent(new JLabel("A Label"));
      tableModel.addComponent(new JCheckBox("A CheckBox"));
      tableModel.addComponent(new JFileChooser());
      tableModel.addComponent(new JColorChooser());
    }
View Full Code Here

     */
    public static Color showDialog(Component component, String title,
                                   Color startingColor) {
        Color initColor = startingColor != null ? startingColor : Color.white;

        final JColorChooser jcc = new JColorChooser(initColor);
        ColorTracker ok = new ColorTracker(jcc);

        jcc.getSelectionModel().addChangeListener(ok);
       
        /* WORKAROUND for Java bug #5029286 and #6199676 */
        //        jcc.setPreviewPanel(ok.getTransparancyAdjustment(initColor.getAlpha()));
        JComponent previewPanel = ok.getTransparancyAdjustment(initColor.getAlpha());
        previewPanel.setSize(previewPanel.getPreferredSize());
        previewPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0));
        jcc.setPreviewPanel(previewPanel);
       
        JDialog colorDialog = JColorChooser.createDialog(component,
                title,
                true,
                jcc,
View Full Code Here

      super("", icon,
          title,
          tipText,
          colorPropertyName);
      setLayout(new BorderLayout());
      add(colorChooser=new JColorChooser(),BorderLayout.CENTER);
    }
View Full Code Here

      //set it up as the editor for all Color cells.
      final ColorEditor colorEditor = new ColorEditor(button);
      setDefaultEditor(Color.class, colorEditor);

      //Set up the dialog that the button brings up.
      final JColorChooser colorChooser = new JColorChooser();
      ActionListener okListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          colorEditor.currentColor = colorChooser.getColor();
        }
      };
      final JDialog dialog = JColorChooser.createDialog(button,
                      resources.getString("PickAColor"),
                      true,
                      colorChooser,
                      okListener,
                      null); //XXXDoublecheck this is OK

      //Here's the code that brings up the dialog.
      button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          button.setBackground(colorEditor.currentColor);
          colorChooser.setColor(colorEditor.currentColor);
          //Without the following line, the dialog comes up
          //in the middle of the screen.
          dialog.setLocationRelativeTo(button);
          dialog.show();
        }
View Full Code Here

  static Color showColorDialog(Color initialColor) {
    if (JSynoptic.gui == null) {
      return null;
    }
    if (colorChooserPane == null) {
      colorChooserPane = new JColorChooser(initialColor);
      colorListener = new ColorListener();
      colorChooserDialog = JColorChooser.createDialog(JSynoptic.gui.getOwner(),
          resources.getStringValue("backgroundColorTitle"),
          true, colorChooserPane, colorListener,null);
    } else {
View Full Code Here

    public static ColorChooserProvider colorChooserProvider = new ColorChooserProvider();

    protected JColorChooser chooser;

    public ColorChooserProvider() {
        chooser = new JColorChooser();
    }
View Full Code Here

            boolean _dialogOk;

            public void actionPerformed(ActionEvent e) {
                final JDialog dialog = new JDialog(_owner, true);
                dialog.setTitle(_title);
                JColorChooser chooser = ColorChooserProvider.colorChooserProvider.getColorChooser();
                dialog.getContentPane().add(chooser);
                JButton cancel, ok;
                JPanel p = new JPanel();
                // TODO i18n
                p.add(ok = new JButton("OK"));
                p.add(cancel = new JButton("Cancel"));
                _dialogOk = false;
                ok.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        _dialogOk = true;
                        dialog.dispose();
                    }
                });
                cancel.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        dialog.dispose();
                    }
                });
                dialog.getContentPane().add(p, BorderLayout.SOUTH);
                dialog.pack();
                dialog.setVisible(true);
                if (_dialogOk) {
                    set(chooser.getColor());
                }
            }
        });
    }
View Full Code Here

            }     
          } catch (MissingResourceException ex) {
            // Let labels unchanged
          }
         
          colorChooser = new JColorChooser();
          // Add auto selection to color chooser panels text fields
          addAutoSelectionOnTextFields(colorChooser);
          // Add Esc key management
          colorChooser.getActionMap().put("close", new AbstractAction() {
              public void actionPerformed(ActionEvent ev) {
View Full Code Here

TOP

Related Classes of javax.swing.JColorChooser$AccessibleJColorChooser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.