Examples of JColorChooser


Examples of javax.swing.JColorChooser

public class ColorChooserComponentFactoryTest extends BasicSwingTestCase {
    private JColorChooser colorChooser;

    @Override
    public void setUp() throws Exception {
        colorChooser = new JColorChooser(Color.GREEN);
    }
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

    return ColorTracker.colorChooser;
  }

  public static Color showCommonJColorChooserDialog(final Component component, final String title,
                                                    final Color initialColor, final Color defaultColor) {
    final JColorChooser pane = ColorTracker.getCommonJColorChooser();
    pane.setColor(initialColor);
    final ColorTracker ok = new ColorTracker(pane);
    final JDialog dialog = JColorChooser.createDialog(component, title, true, pane, ok, null);
    final Container container = (Container) dialog.getContentPane().getComponent(1);
    if(defaultColor != null){
      final JButton defaultBtn = new JButton(TextUtils.getText("reset_to_default"));
View Full Code Here

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, // modal
        colorChooser, this, // OK button handler
        null); // no CANCEL button handler
  }
View Full Code Here

Examples of javax.swing.JColorChooser

     * manipulated depending on the users selection on choices = 1
     * JColorChooser for discrete and 2 JColorChoosers for gradient. We'll
     * default to 1 but will construct them both.
     */
    colorChooserPanel = new JPanel();
    colChose1 = new JColorChooser(Color.black);
    colChose1.setBorder(BorderFactory.createTitledBorder("Choose Color"));
    colChose2 = new JColorChooser(Color.white);
    colChose2.setBorder(BorderFactory.createTitledBorder("Choose Color 2"));
    colorChooserPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    colorChooserPanel.add(colChose1);

    // ***********************************************************
 
View Full Code Here

Examples of javax.swing.JColorChooser

        canvas1.repaint();
    }

    @Action
    public void setBackgroundColor() {
        JColorChooser clr = new JColorChooser();
        maps_color = clr.showDialog(this.getComponent(), "Wybierz kolor tła", maps_color);
        Paint(canvas1.getGraphics());
    }
View Full Code Here

Examples of javax.swing.JColorChooser

        Paint(canvas1.getGraphics());
    }

    @Action
    public void setPawnColor() {
        JColorChooser clr = new JColorChooser();
        pawn_color = clr.showDialog(this.getComponent(), "Wybierz kolor pionka", pawn_color);
        Paint(canvas1.getGraphics());
    }
View Full Code Here

Examples of javax.swing.JColorChooser

        Paint(canvas1.getGraphics());
    }

    @Action
    public void setFilledPawnColor() {
        JColorChooser clr = new JColorChooser();
        pawn_fill_color = clr.showDialog(this.getComponent(), "Wybierz kolor wypełnienia pionka", pawn_fill_color);
        Paint(canvas1.getGraphics());
    }
View Full Code Here

Examples of javax.swing.JColorChooser

        Paint(canvas1.getGraphics());
    }

    @Action
    public void setSelectedColor() {
        JColorChooser clr = new JColorChooser();
        selected_color = clr.showDialog(this.getComponent(), "Wybierz kolor zaznaczonego pola", selected_color);
        Paint(canvas1.getGraphics());
    }
View Full Code Here

Examples of javax.swing.JColorChooser

      this.controller.setModoCursor(Trab03Controller.MODO_REMOCAO_POLIGONOS);
    } else if (e.getKeyCode() == KeyEvent.VK_C) {
      if (this.controller.modoSelecaoPoligonos()) {
        Renderable objeto = this.controller.getObjetoSelecionado();
        if (objeto != null) {
          colorChooser = new JColorChooser();
          colorChooser.getSelectionModel().addChangeListener(this);
          colorChooser.setBorder(BorderFactory.createTitledBorder("Escolha a cor"));
          colorChooser.setPreferredSize(new Dimension(400, 300));
          JPanel panel = new JPanel();
          panel.setLayout(new BorderLayout());
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.