Problems with Substance

Okay, I'm not sure if this problem has popped up on the Substance side or on the JMEDesktop side, but for whatever reason Substance L&F does not seem to be working in the latest CVS version of jME.  If I simply add substance.jar to the classpath and then add "UIManager.setLookAndFeel(new SubstanceLookAndFeel());" at the beginning of the main method for HelloJMEDesktop I get the following exception:


java.lang.NullPointerException
   at org.jvnet.lafwidget.desktop.DesktopIconHoverPreviewWidget.updateSnapshot(DesktopIconHoverPreviewWidget.java:231)
   at org.jvnet.lafwidget.desktop.DesktopIconHoverPreviewWidget.access$300(DesktopIconHoverPreviewWidget.java:52)
   at org.jvnet.lafwidget.desktop.DesktopIconHoverPreviewWidget$1.propertyChange(DesktopIconHoverPreviewWidget.java:147)
   at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
   at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
   at java.awt.Component.firePropertyChange(Component.java:7802)
   at javax.swing.JComponent.addNotify(JComponent.java:4646)
   at java.awt.Container.addNotify(Container.java:2518)
   at java.awt.Window.addNotify(Window.java:633)
   at java.awt.Frame.addNotify(Frame.java:469)
   at java.awt.Window.pack(Window.java:661)
   at com.jmex.awt.swingui.JMEDesktop.<init>(JMEDesktop.java:247)
   at com.jmex.awt.swingui.JMEDesktop.<init>(JMEDesktop.java:285)
   at com.jmex.awt.swingui.JMEDesktop.<init>(JMEDesktop.java:266)
   at jmetest.awt.swingui.HelloJMEDesktop.simpleInitGame(HelloJMEDesktop.java:67)
   at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:474)
   at com.jme.app.BaseGame.start(BaseGame.java:56)
   at jmetest.awt.swingui.HelloJMEDesktop.main(HelloJMEDesktop.java:128)



I've tried 2.3 release and the beta for 3.1 for Substance and they both get this.  Also tried in JRE 1.5 and 1.6 without a change.  It looks like something has changed in JMEDesktop that might be causing this, but I'll have to rely on my good friend Irrisor to help me determine that one. ;)

I swapped out the JAR with my old substance.jar that I used for Roll-A-Rama and it's still throwing that exception, so it must be a change on our end that is causing this.



It's a shame since Substance L&F is probably the only really nice looking L&F for games.

I did not take a look at the code but I remember that I fixed some NPEs in substance the last time I tried using it with JMEDesktop. So the problem is probably not new. Dl the source and have a look what's going wrong. Most probably it is easily fixed by a !=null check.

Thanks for reporting this issue. This has been filed at [1] and fixed in Substance 3.0 and 3.1.



irrisor - if you encounter NPEs (or any other problems with Substance), i'd appreciate if you drop me an e-mail to kirillcool [at] yahoo [dot] com or report them through issue tracker at the project site - this way all Substance users will be able to benefit from the fixes.



Kirill



[1] https://laf-widget.dev.java.net/issues/show_bug.cgi?id=3

kirillcool said:

irrisor - if you encounter NPEs (or any other problems with Substance), i'd appreciate if you drop me an e-mail to kirillcool [at] yahoo [dot] com or report them through issue tracker at the project site - this way all Substance users will be able to benefit from the fixes.

sure - I was too lazy, sorry

Kirill,



Thanks for the fix, I just updated the JAR and it works great.



Keep up the good work! :slight_smile: