Package javax.swing

Examples of javax.swing.JColorChooser


     * but is unique to
     * this instance of JXColorSelectionButton.
     * @param chooser The new JColorChooser to use.
     */
    public void setChooser(JColorChooser chooser) {
        JColorChooser oldChooser = getChooser();
        this.chooser = chooser;
        firePropertyChange("chooser",oldChooser,chooser);
    }
View Full Code Here


    JPanel bannerPanel = new JPanel(new BorderLayout());
    bannerPanel.add(banner, BorderLayout.CENTER);
    bannerPanel.setBorder(BorderFactory.createTitledBorder("Banner"));

    // Set up color chooser for setting text colorobj
    tcc = new JColorChooser();

    /**
     * Add lch color panel
     */
    LCHColorPanel hclColor = new LCHColorPanel();
View Full Code Here

  private JPanel createSeriesColorPane() {
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    colorChooser = new JColorChooser(Color.BLACK);
    colorChooser.setToolTipText("Select Series Color");
    colorChooser.setBorder(BorderFactory.createTitledBorder("Color"));
    panel.add(colorChooser);

    return panel;
View Full Code Here

    // initially selected series
    String seriesDesc = (String) seriesSelector.getItemAt(0);
    currentSeries = SeriesType.getSeriesFromDescription(seriesDesc);
    Color initialColor = SeriesType.getColorFromSeries(currentSeries);

    colorChooser = new JColorChooser(initialColor);
    colorChooser.setToolTipText("Select Color");
    colorChooser.getSelectionModel().addChangeListener(
        createColorChooserChangeListener());
    colorChooser.setBorder(BorderFactory.createTitledBorder("Color"));
    seriesColorPane.add(colorChooser);
View Full Code Here

    {
        super();
        setTitle(title);
        setModal(true);
        change_listener_ = null;
        color_chooser_ = new JColorChooser(color);
        color_chooser_.getSelectionModel().addChangeListener(this);
        getContentPane().add(color_chooser_, BorderLayout.CENTER);
        slider_ = new JSlider(JSlider.HORIZONTAL, 0, 255, color.getAlpha());
        slider_.addChangeListener(this);
        slider_.setMajorTickSpacing(85);
View Full Code Here

  private JColorChooser colorChooser;
  private JDialog dialog;
  private Color returnColor;

  public ColorChooser(Component parent, String title, Color initialColor, final ActionListener actionListener) {
    colorChooser = new JColorChooser(initialColor);
    colorChooser.setPreviewPanel(new JPanel());

    AbstractColorChooserPanel[] panel = {colorChooser.getChooserPanels()[0]};
    colorChooser.setChooserPanels(panel);
    dialog = JColorChooser.createDialog(parent, title, true, colorChooser,
View Full Code Here

    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

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

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

    // AbstractColorChooserPanel panels[] = colorChooser.getChooserPanels();

    // The following has the effect of removing the RGB panel and making the HSB panel the default:

    // AbstractColorChooserPanel preferredPanels[] = new AbstractColorChooserPanel[2];
    // preferredPanels[0] = panels[1];
    // preferredPanels[1] = panels[0];
    // colorChooser.setChooserPanels(preferredPanels);

    ActionListener okListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        colorEditor.currentColor = colorChooser.getColor();
        Color newColor = colorEditor.currentColor;
        StyleMapEntry entry = (StyleMapEntry) styleList.get(tbl.getSelectedRow());
        int column = tbl.getSelectedColumn();
        if (column == StyleConstants.BG_COLUMN)
          entry.setBackground(newColor);
        else
          entry.setForeground(newColor);

        tbl.repaint();
      }
    };
    final JDialog dialog = JColorChooser.createDialog(button, "Pick a Color", true, colorChooser,
            okListener, null);

    // 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

    private BasicColorChooserUI ui;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        ch = new JColorChooser();
        ui = (BasicColorChooserUI) ch.getUI();
    }
View Full Code Here

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

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

    // AbstractColorChooserPanel panels[] = colorChooser.getChooserPanels();

    // The following has the effect of removing the RGB panel and making the HSB panel the default:

    // AbstractColorChooserPanel preferredPanels[] = new AbstractColorChooserPanel[2];
    // preferredPanels[0] = panels[1];
    // preferredPanels[1] = panels[0];
    // colorChooser.setChooserPanels(preferredPanels);

    ActionListener okListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        colorEditor.currentColor = colorChooser.getColor();
        Color newColor = colorEditor.currentColor;
        StyleMapEntry entry = (StyleMapEntry) styleList.get(tbl.getSelectedRow());
        int column = tbl.getSelectedColumn();
        if (column == StyleConstants.BG_COLUMN)
          entry.setBackground(newColor);
        else
          entry.setForeground(newColor);

        tbl.repaint();
      }
    };
    final JDialog dialog = JColorChooser.createDialog(button, "Pick a Color", true, colorChooser,
            okListener, null);

    // 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

TOP

Related Classes of javax.swing.JColorChooser

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.