Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Color chooser setColor not working in Java 7 #105

Open
pengfoong opened this issue Nov 9, 2012 · 2 comments
Open

Color chooser setColor not working in Java 7 #105

pengfoong opened this issue Nov 9, 2012 · 2 comments

Comments

@pengfoong
Copy link

In Java 7, with skin set, JColorChooser.setColor does not change the color selected in the chooser panels. This happens for all the chooser panels.

All the chooser panels will show the white color no matter what color is set. For example, the RGB slider will all be 255, 255 ,255. However, the bar next to the tool that let you pick color from anywhere from screen works. It changes color when setColor is called.

This happens in 7.1 and 7.2. My machine is a windows 7 x64 if it matters. The problem doesn't appear in Java 6.

Here is a sample application to replicate the problem. Also, the color chooser in the demo doesn't work. Most of the items are invisible. It works on Java 6 though.

public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SubstanceLookAndFeel.setSkin(new OfficeBlue2007Skin()); JColorChooser chooser = new JColorChooser(); chooser.setColor(Color.yellow); JDialog dialog = JColorChooser.createDialog(null, "title", true, chooser, null, null); dialog.setVisible(true); } }); }
@enwired
Copy link

enwired commented Nov 9, 2012

I can also reproduce this problem. It works fine with Java 6 (1.6.0_30-b12), but not with Java 7 (1.7.0_07-b11). I'm also on Windows 7 x64.

There also some layout-related problems with this special color chooser UI. (I may file bugs for those later.) I think there is a substance property you can set to make it use the standard color-chooser UI, but I've forgotten what that constant is.

@ebourg
Copy link

ebourg commented Apr 24, 2013

You can work around this issue by setting the ColorChooser.defaultChoosers UI property :

UIManager.put("ColorChooser.defaultChoosers",
        new String[]{
                "org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser.SwatchesChooser",
                "org.pushingpixels.substance.internal.contrib.xoetrope.editor.color.ColorWheelPanel"
        });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants