Java material – strange exception
•
Java
I use substance look and feel version 6.0 in Java Swing applications This application applies to me, but some application users, especially those using Windows 7, are getting material exceptions:
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 on the last line of 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 material question, so I would appreciate it if you could help me
Solution
The immateriality of the current build (this is the maintenance branch of matter) and swing x will not have this error, so it is a fixed error
This is a code example
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>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码