I have a problem, that when i hit the Return key, in the state INTRO (as default) it have to switch to GAME state. It does, but when it does, it blinks between INTRO and GAME State. The Text blinks, and the bar at the bottom blinks.

I'd try to print out the current state, and it seems that its not changing between those two states, but when i run the application, my INTRO state, and GAME state, is both there, and is blinking.

Can't figure out whats wrong. Maybe someone here does?

public Renderer() {
    try {
        Display.setDisplayMode(new DisplayMode(screenWidth, screenHeight));
        Display.setTitle(gameTitle);
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }
 
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 640, 0, 480, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
 
    lastFrame = getTime();
 
 
    while (!Display.isCloseRequested()) {
        //long delta = (long) getDelta();
 
        System.out.println(state);
 
        while (Keyboard.next()) {
            if(Keyboard.isKeyDown(Keyboard.KEY_RETURN)) {
                if(state == State.INTRO) {
                    clearCanvas();
                    state = State.GAME;
                }
            }
            if(Keyboard.isKeyDown(Keyboard.KEY_BACK)) {
                if(state == State.GAME) {
                    clearCanvas();
                    state = State.INTRO;
                }
            }
        }
 
        switch (state) {
        case INTRO:
            GL11.glColor3f(1.0f, 1.0f, 1.0f);
            TextDraw.drawString("PRESS 'RETURN' TO START GAME, and then hit CTRL z", Display.getWidth() / 2 - 160, Display.getHeight() / 2);
            TextDraw.drawString("CONTROLS:", Display.getWidth() / 2 - 30, Display.getHeight() / 2 - 50);
            TextDraw.drawString("1 key is Paint Red", Display.getWidth() / 2 - 70, Display.getHeight() / 2 - 70);
            TextDraw.drawString("2 key is Paint Green", Display.getWidth() / 2 - 70, Display.getHeight() / 2 - 85);
            TextDraw.drawString("3 key is Paint Blue", Display.getWidth() / 2 - 70, Display.getHeight() / 2 - 100);
            TextDraw.drawString("CTRL Z is Clear canvas", Display.getWidth() / 2 - 70, Display.getHeight() / 2 - 115);
            TextDraw.drawString("Escape to Close Program", Display.getWidth() / 2 - 70, Display.getHeight() / 2 - 130);
            break;
        case GAME:
            keyBindings();
            int MouseX = Mouse.getX();
            int MouseY = Mouse.getY();
            paint(MouseX, MouseY);
            break;
        }
 
        Display.update();
        Display.sync(250);
    }
 
    //Closed
    System.out.println("Program Closed");
    Display.destroy();
    System.exit(0);
 
}