The following code freezes my application, but no error is printed to the console. It looks like some sort of livelock/deadlock issue, but I can't determine the source.
The goal is to have the option to shift the Display from one canvas to a different one.
Here's a (slimmed down) version of the code:
public void setDisplayTo(Canvas canvas)
{
if(canvas != Display.getParent())
{
Display.getParent().removeComponentListener(this);
try
{
Display.setParent(canvas);
Display.getParent().addComponentListener(this);
}
catch (LWJGLException e)
{
e.printStackTrace();
}
}
}
So: How can I get this to work? Or should I not bother with this functionality? I was going to add it for completion's sake, but it's not very necessary.
Ensure you run on the EDT somehow, use JConsole to see whether AWT-Eventqueue Thread is locked.