SimpleCanvasImpl

Hi,

looking at JMESwingTest, I wanted replace a SimpleCanvasImpl extended object of a JMECanvas by another one while resizing:



protected void doResize() {
         impl=new MyImplementor(comp.getWidth(),comp.getHeight());
         ((JMECanvas)comp).setImplementor(impl);
         
      }


This code worked with JME 1.x. But with 2.0, I got the following exception:


Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at com.jmex.awt.SimpleCanvasImpl.doUpdate(Unknown Source)
at com.jmex.awt.lwjgl.LWJGLCanvas.paintGL(Unknown Source)
at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:290)
at org.lwjgl.opengl.AWTGLCanvas.update(AWTGLCanvas.java:321)
at sun.awt.RepaintArea.updateComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at JMESwingTest3$SwingFrame$6.dispatchEvent(JMESwingTest3.java:323)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


Best,
Andreas

Hi,

it was easier to implement :slight_smile: and I just did it as you described. But, I would prefer beeig able to replace it, not only for this cause. There seems to be a thread that I don't know how to access or stop.



Best,

Andreas

Why do you need to replace the implementor?  Why not just resize the current one?