Hi, I would like to split code and gui
Then So i’ve read it works for an applet and a frame and webstart. So I created 2 new classes one for a Frame and one for an applet.
I have never worked with applets before, but for now I would like to use the frame.
What would go in that TetrisFrame class? the creation of the frame, keylisteners, buffer strategy?
I used extends canvas in my Game class and then add it to the frame.
To makes things even more (complicated) ;D I use a Game_Manager that creates all the game objects, starts a thread, and should start a Frame or Applet.
I alsoo want to say that I use Awt.
So this is what i got now:
- I start in Game_Manager create a Game_Manager Object from there
- I start my thread and all the objects i need to start a game
- I start the Frame or applet Object , passing the Game var.
- It creates a Frame and adds a game Canvas inside it
- The game starts.
what happens to the keylisteners in what class should they go?
and where does the buffer strategy goes?
Game = a canvas object ?
is there a tutorial for this
at the moment the buffer is in the Game Constructor method and is called before it is added to the frame. Giving the following error:
Exception in thread "main" java.lang.IllegalStateException: Component must have a valid peer
at java.awt.Component$FlipBufferStrategy.createBuffers(Component.java:3362)
I understand why but don’t know how to fix it, because when I create a frame I have to add the game!
Help appreciated 
Game_Management code snipet of starting a game.
public Game_Management() {
bFact = new BlockFactory();
board = new Board(20,10,Block.TILE_SIZE);
game = new Game(this,board,bFact);
if (CREATE_FRAME) {
new TetrisFrame(game);
}
else {
new TetrisApplet(game);
}
startGame();
}
public void startGame() {
/* Initialize the game thread. */
GameThread = new GameThread();
GameThread.start();
}
private class GameThread extends Thread {
public void run() {
game.run();
}
}

