Java Code Examples for javax.swing.JColorChooser#createDialog()
The following examples show how to use
javax.swing.JColorChooser#createDialog() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColorSelectionButton.java From rapidminer-studio with GNU Affero General Public License v3.0 | 7 votes |
private Color showDialog(Component component, String title, Color initialColor) throws HeadlessException { final JColorChooser chooser = new JColorChooser(initialColor != null ? initialColor : Color.white); // configuring color chooser panel chooser.setPreviewPanel(new JPanel()); if (colorChoosers != null) { chooser.setChooserPanels(colorChoosers); } else { chooser.removeChooserPanel(chooser.getChooserPanels()[0]); chooser.removeChooserPanel(chooser.getChooserPanels()[1]); } // creating dialog ColorTracker ok = new ColorTracker(chooser); JDialog dialog = JColorChooser.createDialog(component, title, true, chooser, ok, null); dialog.setVisible(true); // blocks until user brings dialog down... return ok.getColor(); }
Example 2
Source File: ColorEditor.java From marathonv5 with Apache License 2.0 | 6 votes |
public ColorEditor() { // Set up the editor (from the table's point of view), // which is a button. // This button brings up the color chooser dialog, // which is the editor from the user's point of view. button = new JButton(); 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 }
Example 3
Source File: Test4177735.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 4
Source File: ColorChooserPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
protected Color showMoreColorsDialog() { JColorChooser colorChooser = new JColorChooser(getSelectedColor()); AbstractColorChooserPanel[] oldChooserPanels = colorChooser.getChooserPanels(); AbstractColorChooserPanel[] newChooserPanels = new AbstractColorChooserPanel[oldChooserPanels.length + 1]; System.arraycopy(oldChooserPanels, 0, newChooserPanels, 1, oldChooserPanels.length); newChooserPanels[0] = new MyAbstractColorChooserPanel(); colorChooser.setChooserPanels(newChooserPanels); ColorTracker colorTracker = new ColorTracker(colorChooser); JDialog dialog = JColorChooser.createDialog(this, "Select Colour", true, colorChooser, colorTracker, null); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setVisible(true); return colorTracker.getColor(); }
Example 5
Source File: MakeColorsPane.java From DroidUIBuilder with Apache License 2.0 | 5 votes |
public ColorEditor() { b = new JButton("Edit"); b.addActionListener(this); cc = new JColorChooser(); dl = JColorChooser.createDialog(b, "Choose a Color", true, cc, this, null); }
Example 6
Source File: Test4177735.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 7
Source File: ColorTableCellEditor.java From jdal with Apache License 2.0 | 5 votes |
public ColorTableCellEditor() { button = new JButton(); 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, StaticMessageSource.getMessage("ColorChooser.chooseColor"), true, //modal colorChooser, this, //OK button handler null); //no CANCEL button handler }
Example 8
Source File: Test4177735.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 9
Source File: Test4177735.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 10
Source File: Test4177735.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 11
Source File: Test4177735.java From hottub with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 12
Source File: Test4177735.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 13
Source File: Test4177735.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 14
Source File: Test4319113.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent actionEvent) { Object object = actionEvent.getSource(); Component component = object instanceof Component ? (Component)object : null; JDialog jDialog = JColorChooser.createDialog(component, "ColorChooser", false, new JColorChooser(Color.BLUE), null, null); jDialog.setVisible(true); }
Example 15
Source File: Test4177735.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 16
Source File: Test4177735.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 17
Source File: Test4177735.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 18
Source File: Test4177735.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static JDialog show(JColorChooser chooser) { JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null); dialog.setVisible(true); // block till displayed Point point = null; while (point == null) { try { point = dialog.getLocationOnScreen(); } catch (IllegalStateException exception) { pause(DELAY); } } return dialog; }
Example 19
Source File: HexColorCellEditor.java From niftyeditor with Apache License 2.0 | 4 votes |
public void actionPerformed(ActionEvent e) { colorDialog = JColorChooser.createDialog(frame, "Choose A Color", true, colorChooser, okListener, cancelListener); colorDialog.setVisible(true); }
Example 20
Source File: ColorEditor.java From jpexs-decompiler with GNU General Public License v3.0 | 4 votes |
private static Color noTransparencyColorChooser(Component component, String title, Color initialColor) throws Exception { final JColorChooser pane = new JColorChooser(initialColor != null ? initialColor : Color.white); AbstractColorChooserPanel[] colorPanels = pane.getChooserPanels(); for (int i = 1; i < colorPanels.length; i++) { AbstractColorChooserPanel cp = colorPanels[i]; Field f = cp.getClass().getDeclaredField("panel"); f.setAccessible(true); Object colorPanel = f.get(cp); Field f2 = colorPanel.getClass().getDeclaredField("spinners"); f2.setAccessible(true); Object spinners = f2.get(colorPanel); Object transpSlispinner = Array.get(spinners, 3); if (i == colorPanels.length - 1) { transpSlispinner = Array.get(spinners, 4); } Field f3 = transpSlispinner.getClass().getDeclaredField("slider"); f3.setAccessible(true); JSlider slider = (JSlider) f3.get(transpSlispinner); slider.setEnabled(false); Field f4 = transpSlispinner.getClass().getDeclaredField("spinner"); f4.setAccessible(true); JSpinner spinner = (JSpinner) f4.get(transpSlispinner); spinner.setEnabled(false); } final Color[] col = new Color[]{initialColor}; JDialog dialog = JColorChooser.createDialog(component, title, true, pane, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { col[0] = pane.getColor(); } }, null); dialog.setVisible(true); return col[0]; }