Deadlock while creating Swing components

Hello,

I’m trying to programm an OpenGL chess game with something like a ‘move history manager’.
The history manager is a JPanel embedded in a JScrollPane (like on the left side of this picture : http://www.horustempel.de/OpenGL/Jogl/chessgame.jpg ).
Everytime the player is making a move I’m adding a new move into the history manager (adding a new JPanel with the moved piece and the new field, the piece has moved on).

My problem is that sometimes, not always I get a deadlock when creating the new JLabel, that means my programm doesn’t react anymore on inputs and I have no other chance than to kill the process.

I think that has something to do, that I create the JPanel in the display function.
But is there a chance to create Swing or Awt components outside the display function, when using the Animator class?

Oliver

once a frame is visible, you have to add/remove components from the Event Dispatch Thread.

A simple way to do that is to post a runnable in the event queue :

SwingUtiliies.invokeLater(new Runnable(){
public void run(){
//component update here
}
});

Lilian