I am using Substance look and feel version 6.0 in my Java Swing application. The application works fine for me, but some of the application users especially those using Windows 7 are getting a substance exception :
java.lang.InternalError: Unable to instantiate org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser.ColorPalettesChooser
at org.pushingpixels.substance.internal.ui.SubstanceColorChooserUI.createDefaultChoosers(SubstanceColorChooserUI.java)
at org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.Quaqua13ColorChooserUI.__org__pushingpixels__substance__internal__contrib__randelshofer__quaqua__Quaqua13ColorChooserUI__installUI(Quaqua13ColorChooserUI.java)
at org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.Quaqua13ColorChooserUI.installUI(Quaqua13ColorChooserUI.java)
at org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.Quaqua14ColorChooserUI.__org__pushingpixels__substance__internal__contrib__randelshofer__quaqua__Quaqua14ColorChooserUI__installUI(Quaqua14ColorChooserUI.java)
at org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.Quaqua14ColorChooserUI.installUI(Quaqua14ColorChooserUI.java)
at org.pushingpixels.substance.internal.ui.SubstanceColorChooserUI.__org__pushingpixels__substance__internal__ui__SubstanceColorChooserUI__installUI(SubstanceColorChooserUI.java)
at org.pushingpixels.substance.internal.ui.SubstanceColorChooserUI.installUI(SubstanceColorChooserUI.java)
at javax.swing.JComponent.setUI(Unknown Source)
at javax.swing.JColorChooser.setUI(Unknown Source)
at javax.swing.JColorChooser.updateUI(Unknown Source)
at javax.swing.JColorChooser.(Unknown Source)
at javax.swing.JColorChooser.(Unknown Source)
at javax.swing.JColorChooser.(Unknown Source)
at org.jdesktop.swingx.JXColorSelectionButton.getChooser(JXColorSelectionButton.java)
at org.jdesktop.swingx.JXColorSelectionButton$1.propertyChange(JXColorSelectionButton.java)
at java.beans.PropertyChangeSupport.fire(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.awt.Component.firePropertyChange(Unknown Source)
at java.awt.Component.setBackground(Unknown Source)
at javax.swing.JComponent.setBackground(Unknown Source)
This exception occurs in the last line in this code :
JXColorSelectionButton myColorSelectionButton = new JXColorSelectionButton();
myColorSelectionButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
myColorSelectionButton.setFocusPainted(false);
contentPane.add(myColorSelectionButton, cc.xy(29, 19));
/**
* Some code here
*/
myColorSelectionButton.setBackground( Color.WHITE ); // Excepton occurres here !!
I can't find a place to ask this Substance question so if you can help me out that would be appreciated.
Substance is no longer updated and is broken on Java 7.
However someone has pick the project back up by forking it and calling it insubstance: http://shemnon.com/speling/
Which it supports Java 7 and seems to have big plans for the next update.
It should be as simple as swapping the libraries over to get it working in your project.
Current builds of insubstantial, (which is a maintenance fork of Substance) and SwingX do not exhibit this error, so it's a bug that has been fixed.
Here's a code sample in
import java.awt.Color
import javax.swing.*
import org.jdesktop.swingx.JXColorSelectionButton
SwingUtilities.invokeAndWait {
@Grapes(
[@Grab(group='org.swinglabs', module='swingx-core', version='1.6.2-2'),
@Grab(group='com.github.insubstantial', module='substance-swingx', version='7.0') ]
)
JFrame frame = new JFrame("Test");
JXColorSelectionButton myColorSelectionButton = new JXColorSelectionButton();
myColorSelectionButton.setFocusPainted(false);
frame.add(myColorSelectionButton);
myColorSelectionButton.setBackground( Color.WHITE ); // Excepton occurres here !!
frame.pack()
frame.setVisible(true)
}
Relevant Maven Coordinates:
<dependency>
<groupId>com.github.insubstantial</groupId>
<artifactId>substance</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx-core</artifactId>
<version>1.6.2-2</version>
</dependency>
<dependency>
<groupId>com.github.insubstantial</groupId>
<artifactId>substance-swingx</artifactId>
<version>7.0</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With