Starting the game through a GUI


I want to display a GUI with and "Start Game" button. What am i trying?

I have a class that extends SimplePhysicsGame, defined like follows:

public class Jogo extends SimplePhysicsGame{
  private boolean started = false;
  private boolean paused = false;
  protected void simpleUpdate(){   
    if (started){
    if (KeyBindingManager.getKeyBindingManager().isValidCommand("pause", false))
    paused = !paused;        
    if (paused)
    // draw the gui stuff after the scene
                display.getRenderer().draw( guiNode );

    protected void simpleInitGame() {

    private void initializeInterface(){
        // do some stuff here
        button.addActionListener( new ActionListener() {
                    public void actionPerformed( ActionEvent e ) {
                        // this gets executed in swing thread
                        // alter swing components ony in swing thread!                   
                } );
    private void startGame(){
          started = true;                           
          // do some start game stuff


At the startGame method, i call a lot of methods that renders the game for the first time. Inside of one of that methods, i have the following line:


When that line executes i get a java.lang.NullPointerException at org.lwjgl.opengl.GL11.glGenTextures(

And if i simple, run the startGame method without calling it by that button (through the GUI), i dont get that exception.

Any ideas?

do not call startGame from the swing thread but from the main thread