Problem with kev's spaceinvaders

Hi, I’ve created a simple gui that call the game class of spaceInvaders game http://www.cokeandcode.com/info/showsrc/showsrc.php?src=../spaceinvaders/org/newdawn/spaceinvaders/Game.java

The problem is that I can’t play the game, it doesn’t reply at any key events:

this is the code from my gui where I call game:


public void actionPerformed(ActionEvent e)
            {   
            Object src = e.getSource();                          
            
             if( src.equals(start) )
                {
                frameOwner.dispose();
                
                Game game = new Game();      
                g.gameLoop();
                }

start is a JButton, and frameOwner is the JFrame of the GUI

gameLoop() doesn’t return. You’ve called it from the AWT event handler and hence the AWT event thread - which will then block any further AWT events. If you changed it to:


Thread t = new Thread() {
    public void run() {
         Game game = new Game();
         game.gameLoop();
    }
}
t.start();

Kev

Thanks very much! now it run ;D