-
Notifications
You must be signed in to change notification settings - Fork 57
NullException #56
Comments
Can you attach the "main.java" class referenced in the stack trace? |
public static void main(String args[]){
this is the main method.. the try..catch is the only one i modified others are generated by netbeans.. im using jdk 1.7 by the way.. does it have to do with it? |
import org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel; /*
/*
oh im sorry i misunderstand i thought the main method.. this is the "main.java" class.. hope u can identify what causes the problem. thanks |
The code you provided runs fine. But doesn't match up with the stack trace because the first departure point in main.java was at line 261 and the source you posted was only 87 lines long. My take is that you are doing something before instantiating the frame that is essential to this failure. |
thanks to ur help but it seems that i always got the same error everytime.. only 7 libraries are needed to run this right? .. maybe i missed something.. is there a simple step by step process on how to use insubstantial laf im kinda new to java..thanks |
public static void main(String args[]) {
i dont think i did the right thing but i just doubled the try..catch...with same syntax inside the first gives nullpointer exception but the second one works fine anyways thanks for entertaining my issue..keep up the good work. :) |
This really seems to be a problem. I also get this error while trying to start insubstance. But the example above works! Why? Why does it work if i use two try catch blocks? Also, if i take a project that i've worked on and that works fine with insubstance 7 and i replace the libraries with insubstance 7.1, i get this error... There is something wrong here. |
I have been unable top reproduce it. A better test case needs to be provided or this will languish in an unaddressed state. |
Hi, I have been using insubstantial for a while now. Today I experienced this exact same issue. All of sudden after running an SVN update. Since I have other projects using the same insubst. configuration and libraries working, I thought this wouldn't be a problem in substance... So I created a new project in Netbeans, copied the libraries and sources from the broken project into the new one and ran the program without any issues. After reloading the libraries into my original project I was able to run it as well. Finally, my config: |
I use Eclipse, so i don't think this has something todo with NetBeans |
I'm receiving a similar error on some test code I've copied and pasted from here (including it here for making life easier); import java.awt.; public class SampleApp extends JFrame {
} the stack trace as follows Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException I'm running a Windows 7 Ultimate (64bit). My JDK/JRE for test are 1.6.0.21 (64bit) and 1.6.0.23 (32 bit). With neither of those the example would run. Funny how the demo app with all features and whatnot runs fine over java-webstart (using latest JRE for that, that is a 1.7.something) A few "*" are missing, don't know why. The version of insubstantial I'm using is 6.3 and I have all the possible packages from the download page |
Today i tried this again. I get this error:
by executing this java code: import java.awt.Dimension;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.UIManager;
import org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel;
public class MAIN {
public static void main(String[] args) {
useSubstanceLAF();
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
JFrame frame = new JFrame("TEST");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(400, 300));
frame.setVisible(true);
frame.pack();
}
});
}
public static void useSubstanceLAF() {
try {
JFrame.setDefaultLookAndFeelDecorated(true);
UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
} catch (Exception e) {
e.getStackTrace();
}
}
} if i try this, it works: import java.awt.Dimension;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.UIManager;
import org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel;
public class MAIN {
public static void main(String[] args) {
useSubstanceLAF();
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
JFrame frame = new JFrame("TEST");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(400, 300));
frame.setVisible(true);
frame.pack();
}
});
}
public static void useSubstanceLAF() {
try {
JFrame.setDefaultLookAndFeelDecorated(true);
UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
} catch (Exception e) {
e.getStackTrace();
}
try {
JFrame.setDefaultLookAndFeelDecorated(true);
UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
} catch (Exception e) {
e.getStackTrace();
}
}
} i am using eclipse juno with JDK 1.7.0 on windows xp 32 bit. |
it seems to be necesarry to call |
Thank you Endogen. Code-twice works on my aforementioned configuration too. |
None of the provided sample programs break for me. I'm running 7u6. Since double setting the PLAF seems to fix it I'm going to move this to "King of Thieves" (i.e. it's a problem with no planned fix). |
I think you got the same problem as me when i updated the library... The SubstanceLookAndFeel.setSkin(..) method ends with (line 2156) :
I think you should add some log messages here or let the exception to happen as the setSkin method can call itself when Substance is not the current look and feel (line 2083) :
and if the setSkin method fails (it was my case because of a noClassDefFound error in swingx library), the "return false" on line 2159 and line 2161 does not interrupt the flow execution so you ends up to execute next lines of code :
which will make the NPE to happen as currentSkin has not be set (and still equal null) because of the previous setSkin(...) fail. The error is difficult to trace because of the caught exception without any messages... |
Interesting: I get this error in my application when (erroneously) including the substance-swingx-7.2.jar. If I remove it from my classpath I can use the LaF fine. |
Yeah, this is because you then need the swingx core library, as you probably don't have it you have the famous NoClassDefFoundError i mentioned earlier. |
So, is there an actual way to fix this? And by fixing it I do not mean just writing the try-catch block twice. |
Unfortunately Insubstantial is not maintained anymore. We forked it for our own project but we are just fixing some issues we encounter, also we did some custom patch that you won't ever need... |
@Stephane-D I think you mean to say "Substance" is dead, inSubstantial has commits in the past 6 months. I'd not say that's "dead" unless the repo maintainer says so. |
I too get this error. The fix is above but not clear: To fix, either do not include the "substance-swingx-7.x.jar" file, OR include it and also go download the full "swingx" jar file and include that too. |
I receive this error as well. |
This is still by far the best look and feel for my PhotoGrok application. I've had no problems through the years until Java 9 began throwing this same exception. The comments above helped me find a fix. Unfortunately, you have to compile a new substance.jar and comment out the following for loop from SubstanceLookAndFeel.java. It seems com.sun.swing.internal.plaf.metal.resources.metal bundle isn't found in Java 9. The change did not affect my app (and I do use the file chooser). There may be a more correct solution but this is where I stopped. I hope this helps someone.
|
Hi there. I'm the developer of Substance, and just about to push the release candidate for the next version of it. Would be great if you can try the latest dev bits of 7.1 and see if this issue is still present there. You can find the binaries at https://github.com/kirill-grouchnikov/substance/tree/master/drop |
I was just about to point him over to your project! I'll download the newest version, too. |
Hello. I'm surprised to see Substance is active! I tried the 7.1 dev and it works fine under Java 9 only (Unsupported major.minor version 52.0 when using older jvm). Will it be backward compatible? I like some of the visual changes and would use this new version if it works on Java 6 and up. When do you plan to push the release candidate? Thanks for the great library. Edit to add I see the project works fine with Java 8 (I think I can live with dropping support for Java 6 & 7 anyway). |
I'm also surprised and happy that it is active again. SubstanceLookAndFeel.SCROLL_PANE_BUTTONS_POLICY no longer exists, for example. No replacement is available. ColorSchemeAssociationKind.TEXT_HIGHLIGHT is gone, but was renamed to Plenty of other little changes, but those are two of the ones that caught me off guard. |
Yes, Substance requires Java 8 to build and run starting from version 7.0. SCROLL_PANE_BUTTONS_POLICY was removed as the whole look of the scroll bars has been simplified greatly to fit with the look of the modern UI toolkits / browsers. I do plan additional similar changes to remove elements that have not stood the test of time in the last 7-8 years. |
i get this error every time i tried to use insubstantial..
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.pushingpixels.substance.internal.utils.SubstanceColorUtilities.getDefaultBackgroundColor(SubstanceColorUtilities.java:758)
at org.pushingpixels.substance.internal.utils.SubstanceColorUtilities.getBackgroundFillColor(SubstanceColorUtilities.java:661)
at org.pushingpixels.substance.internal.ui.SubstancePanelUI.__org__pushingpixels__substance__internal__ui__SubstancePanelUI__installDefaults(SubstancePanelUI.java:73)
at org.pushingpixels.substance.internal.ui.SubstancePanelUI.installDefaults(SubstancePanelUI.java)
at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:56)
at org.pushingpixels.substance.internal.ui.SubstancePanelUI.__org__pushingpixels__substance__internal__ui__SubstancePanelUI__installUI(SubstancePanelUI.java)
at org.pushingpixels.substance.internal.ui.SubstancePanelUI.installUI(SubstancePanelUI.java)
at javax.swing.JComponent.setUI(JComponent.java:664)
at javax.swing.JPanel.setUI(JPanel.java:153)
at javax.swing.JPanel.updateUI(JPanel.java:126)
at javax.swing.JPanel.(JPanel.java:86)
at javax.swing.JPanel.(JPanel.java:109)
at javax.swing.JPanel.(JPanel.java:117)
at javax.swing.JRootPane.createGlassPane(JRootPane.java:545)
at javax.swing.JRootPane.(JRootPane.java:365)
at javax.swing.JFrame.createRootPane(JFrame.java:277)
at javax.swing.JFrame.frameInit(JFrame.java:258)
at javax.swing.JFrame.(JFrame.java:181)
at main.(main.java:29)
at main$1.run(main.java:261)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
dont know what is causing the problem..pls help
The text was updated successfully, but these errors were encountered: