Why does this error? the code is within a runnable within the main class. Wind is the (swing) gui class and ShadowLabda is a JSlider. I am trying to set the value’s of the pssmshadows with sliders.
pssmRenderer is instantiated at the start of the canvas
Code:
[java] wind.ShadowLabda.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent evt) {
WindowLuaTest.viewPort.removeProcessor(pssmRenderer); // THIS LINE ERRORS
pssmRenderer.setLambda(wind.ShadowLabda.getValue()/100);
WindowLuaTest.viewPort.addProcessor(pssmRenderer);
}
}); [/java]
Error:
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at com.jme3.renderer.ViewPort.removeProcessor(ViewPort.java:75)
at Prototype.WindowLuaTest$1$3.stateChanged(WindowLuaTest.java:187)
at javax.swing.JSlider.fireStateChanged(JSlider.java:420)
at javax.swing.JSlider$ModelListener.stateChanged(JSlider.java:337)
at javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:348)
at javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:285)
at javax.swing.DefaultBoundedRangeModel.setValueIsAdjusting(DefaultBoundedRangeModel.java:214)
at javax.swing.JSlider.setValueIsAdjusting(JSlider.java:642)
at com.seaglasslookandfeel.ui.SeaGlassSliderUI$SynthTrackListener.mouseDragged(SeaGlassSliderUI.java:861)
at java.awt.Component.processMouseMotionEvent(Component.java:6337)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
at java.awt.Component.processEvent(Component.java:6058)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4255)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
it means “pssmRenderer” field is null when the method was called
1 Like
Also never modify anything jme related in any thread taht is not the JME one.
1 Like
EmpirePhoenix said:
Also never modify anything jme related in any thread taht is not the JME one.
yes, use enqueue for that, doing so ull avoid renderer updateGeometric state exceptions.