Java Code Examples for javax.swing.JColorChooser#setColor()
The following examples show how to use
javax.swing.JColorChooser#setColor() .
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: Test4193384.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 2
Source File: Test4193384.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 3
Source File: Test4193384.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 4
Source File: Test4193384.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 5
Source File: Test4193384.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 6
Source File: Test4193384.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 7
Source File: Test4193384.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 8
Source File: Test4193384.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 9
Source File: Test4193384.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 10
Source File: Test4193384.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void test(Color[] colors) { JLabel label = new JLabel("Preview Panel"); // NON-NLS: simple label JColorChooser chooser = new JColorChooser(); chooser.setPreviewPanel(label); float[] hsb = new float[3]; for (int i = 0; i < colors.length; i++) { Color color = colors[i]; // Make sure sure that there wasn't a regression // in java.awt.Color and the conversion methods Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); if (!color.equals(Color.getHSBColor(hsb[0], hsb[1], hsb[2]))) { throw new Error("color conversion is failed"); } // 4193384 regression test if (!color.equals(new JColorChooser(color).getColor())) { throw new Error("constructor sets incorrect initial color"); } // 4200976 regression test chooser.setColor(color); if (!color.equals(label.getForeground())) { throw new Error("a custom preview panel doesn't handle colors"); } } }
Example 11
Source File: ColorEditor.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates new <code>NbColorChooser</code>. */ public NbColorChooser (final ColorEditor editor, final JColorChooser chooser) { this.editor = editor; selectionModel = chooser.getSelectionModel(); setLayout (new BorderLayout ()); add (chooser, BorderLayout.CENTER); chooser.setColor ((Color)editor.getValue ()); selectionModel.addChangeListener (this); getAccessibleContext().setAccessibleDescription(getString("ACSD_CustomColorEditor")); }
Example 12
Source File: Test4165217.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 13
Source File: Test4165217.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 14
Source File: Test4165217.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 15
Source File: Test4165217.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 16
Source File: Test4165217.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 17
Source File: Test4165217.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 18
Source File: Test4165217.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 19
Source File: Test4165217.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }
Example 20
Source File: Test4165217.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(); chooser.setColor(new Color(new Random().nextInt())); Color before = chooser.getColor(); Color after = copy(chooser).getColor(); if (!after.equals(before)) { throw new Error("color is changed after serialization"); } }