JFrame and Display are fighting with each other?

I originally tried to post this on the LWJGL forums, but kept getting the error that said my “session had timed out.” So I’m posting it here instead.

I’m trying to get a Canvas (with Display.setParent()) working inside of a JFrame. The JFrame has other buttons and controls around the Canvas (to allow for file loading and things). Problem is, that if Display is looping with the focus, I can’t access anything else in the JFrame… and once the JFrame has focus, I have a hard time getting the Display to start updating again! (I get a nullpointer error when trying to access Display at that point).

I’m on a Mac if that helps. Anyone else ever seen or tried this?

Also, for the record, I’ve also tried using AWTGLCanvas with the same results.

ANY help is appreciated!

Well, it took me a bit, but I figured it out. From the beginning I suspected it had something to do with threads.

Looks like you need to keep the JFrame and Display threads completely separate. Basically, I have triggers in the JFrame now that just flag or set variables in the Display thread, and then the Display thread has to do all of the heavy lifting. Not the most elegant solution I suppose, but at least it’s working with my engine now.