Examples of JColorChooser


Examples of javax.swing.JColorChooser

    button.setActionCommand(EDIT);
    button.addActionListener(this);
    button.setBorderPainted(false);

    // Set up the dialog that the button brings up.
    colorChooser = new JColorChooser();
    dialog = JColorChooser.createDialog(button, "Pick a Color", true, colorChooser, this, null);
  }
View Full Code Here

Examples of javax.swing.JColorChooser

            JRadioButton  rbFigs = new JRadioButton();
           
            public void actionPerformed(ActionEvent e) {
                try {
                JColorChooser colorChooser = new JColorChooser();
                Color selectedColor = JColorChooser.showDialog(null, "Choose a color for this plot", new Color(200,200,200));
                changePlotColor(0, selectedColor)
                }
            catch (Exception ex) { 
                System.out.println("Exception in setting Color");
View Full Code Here

Examples of javax.swing.JColorChooser

            }
        }
    }
   
    private void openColorChooser(final MouseEvent evt) {
        final JColorChooser chooser = new JColorChooser();
        JDialog dialog = JColorChooser.createDialog(this, "Select color", true
                , chooser, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if(((JPanel)evt.getSource()).getName().equalsIgnoreCase("pnlBackColor")) {
                    Color newCol = chooser.getColor();
                    float[] comps = new float[3];
                    comps = newCol.getComponents(null);
                    newBackColor = new ColorRGBA(comps[0],comps[1],comps[2],newCol.getTransparency());
                    pnlBackColor.setBackground(newCol);
                   
                } else {
                    Color newCol = chooser.getColor();
                    float[] comps = new float[3];
                    comps = newCol.getComponents(null);
                    newCol.getComponents(comps);
                    newTextColor = new ColorRGBA(comps[0],comps[1],comps[2],newCol.getTransparency());
                    pnlTextColor.setBackground(newCol);
View Full Code Here

Examples of javax.swing.JColorChooser

            }
        }
    }
   
    private void openColorChooser(final MouseEvent evt) {
        final JColorChooser chooser = new JColorChooser();
        JDialog dialog = JColorChooser.createDialog(this, "Select color", true
                , chooser, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
               
                if(((JPanel)evt.getSource()).getName().equalsIgnoreCase("pnlBackColor")) {
                    Color newCol = chooser.getColor();
                    float[] comps = new float[3];
                    comps = newCol.getComponents(null);
                    newBackColor = new ColorRGBA(comps[0],comps[1],comps[2],newCol.getTransparency());
                    pnlBackColor.setBackground(newCol);
                   
                } else {
                    Color newCol = chooser.getColor();
                    float[] comps = new float[3];
                    comps = newCol.getComponents(null);
                    newCol.getComponents(comps);
                    newTextColor = new ColorRGBA(comps[0],comps[1],comps[2],newCol.getTransparency());
                    pnlTextColor.setBackground(newCol);
View Full Code Here

Examples of javax.swing.JColorChooser

    JColorChooser colorChooser;
    Color lastColor;

    ColorItemListener(final JComboBox box) {
      this.box = box;
      colorChooser = new JColorChooser();
      dialog =
        JColorChooser.createDialog(
          box, "Pick a Color", true, //modal
          colorChooser,
          new ActionListener() {
View Full Code Here

Examples of javax.swing.JColorChooser

    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

Examples of javax.swing.JColorChooser

    {
      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

Examples of javax.swing.JColorChooser

                    private Color oldColor;

                    public void actionPerformed(ActionEvent e) {
                        //if (frame == null) {
                        frame = new JFrame("Desktop color");
                        colorChooser = new JColorChooser();
                        frame.add(colorChooser, BorderLayout.CENTER);
                        JButton ok = new JButton("OK");
                        ok.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent event) {
                                desktopPane.setBackground(colorChooser.getColor());
View Full Code Here

Examples of javax.swing.JColorChooser

     * Example usage
     */
    public static void main(String ... args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JColorChooser chooser = new JColorChooser();
                chooser.addChooserPanel(new EyeDropperColorChooserPanel());
                JFrame frame = new JFrame();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(chooser);
                frame.pack();
                frame.setVisible(true);
View Full Code Here

Examples of javax.swing.JColorChooser

     * this instance of JXColorSelectionButton.
     * @return the JColorChooser used by this JXColorSelectionButton
     */
    public JColorChooser getChooser() {
        if(chooser == null) {
            chooser = new JColorChooser();
            // add the eyedropper color chooser panel
            chooser.addChooserPanel(new EyeDropperColorChooserPanel());
        }
        return chooser;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.