JME3 in a Swing Context

Hmmm.

I am actually calling: app.startCanvas();. Once. :slight_smile:

Anyway, I am not using it exactly as it is in TestCanvas. In function createCanvas(), I don't use those try catch clauses with Class.forName(). I just instantiate my application directly like: app = new TestBox();.

Any other ideas? :slight_smile:

Ok, I have been struggling with this for a while now and it just doesn't seem to work properly…  :frowning:

I tried to debug my own program and also TestCanvas, and didn't find anything new. My program just usually doesn't work (but sometimes it strangely does). Anyway, I found out, that when debugging TestCanvas, I can get the same error like in my application. Strangely again, this only happens while debugging. Another thing I noticed, TestCanvas application never ends. You can close the window or click exit, but it will still work (I must manually stop it in Eclipse).

From all this I can only think of one thing: there are probably some problems with threading (hence random working and not stopping test case normally).

Don't know if I am right and if anyone can help, I just don't have a clue anymore how to make it work… :expressionless:

InShadow said:

Ok, I have been struggling with this for a while now and it just doesn't seem to work properly...  :(
I tried to debug my own program and also TestCanvas, and didn't find anything new. My program just usually doesn't work (but sometimes it strangely does). Anyway, I found out, that when debugging TestCanvas, I can get the same error like in my application. Strangely again, this only happens while debugging. Another thing I noticed, TestCanvas application never ends. You can close the window or click exit, but it will still work (I must manually stop it in Eclipse).
From all this I can only think of one thing: there are probably some problems with threading (hence random working and not stopping test case normally).
Don't know if I am right and if anyone can help, I just don't have a clue anymore how to make it work... :|

I fixed the uncloseable-canvas issue. TestCanvas will shut down when you close the window.
The NullPointerException that you mentioned above only happens if there's no SystemListener set on the context (it is required to be set).

I tested that again and TestCanvas doesn't even work anymore… :slight_smile:

While searching through code, I found out that listener is set in Application.startCanvas() function, and this is obviously too late. In my opinion, it should be set in Application.createCanvas(), which is called earlier. This could also be fixed by manually adding contex.setSystemListener(app) to TestCanvas.createCanvas() after calling context = (JmeCanvasContext) app.getContext(); but this doesn't really make any sense since it is making more clutter for the user… :slight_smile: