use of javax.swing.JColorChooser in project jdk8u_jdk by JetBrains.
the class Test4165217 method main.
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");
}
}
use of javax.swing.JColorChooser in project jdk8u_jdk by JetBrains.
the class Test4177735 method main.
public static void main(String[] args) throws Exception {
JColorChooser chooser = new JColorChooser();
AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });
JDialog dialog = show(chooser);
pause(DELAY);
dialog.dispose();
pause(DELAY);
Test4177735 test = new Test4177735();
SwingUtilities.invokeAndWait(test);
if (test.count != 0) {
throw new Error("JColorChooser leaves " + test.count + " threads running");
}
}
use of javax.swing.JColorChooser in project jdk8u_jdk by JetBrains.
the class Test4193384 method test.
private static void test(Color[] colors) {
// NON-NLS: simple label
JLabel label = new JLabel("Preview Panel");
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");
}
}
}
use of javax.swing.JColorChooser in project jdk8u_jdk by JetBrains.
the class Test4222508 method init.
@Override
public void init() {
this.chooser = new JColorChooser();
this.checkbox = new JCheckBox("Enable the color chooser below", true);
this.checkbox.addItemListener(this);
add(BorderLayout.NORTH, this.checkbox);
add(BorderLayout.CENTER, this.chooser);
}
use of javax.swing.JColorChooser in project jdk8u_jdk by JetBrains.
the class Test4234761 method main.
public static void main(String[] args) {
JColorChooser chooser = new JColorChooser(COLOR);
JDialog dialog = Test4177735.show(chooser);
PropertyChangeListener listener = new Test4234761();
// NON-NLS: property name
chooser.addPropertyChangeListener("color", listener);
JTabbedPane tabbedPane = (JTabbedPane) chooser.getComponent(0);
// HSB tab index
tabbedPane.setSelectedIndex(1);
if (!chooser.getColor().equals(COLOR)) {
listener.propertyChange(null);
}
dialog.dispose();
}
Aggregations