Buggy code:
public class GameOverState extends BasicGameState { private Button playButton ; private Button menuButton ; private Button saveButton ; private Button exitButton ; private MainGame mainGame ; private TextField textField ; private Image tfBackgroundN ; private Image tfBackgroundA ; private Image health0Image ; private Image health1Image ; private Image health2Image ; private Image health3Image ; private Image health4Image ; private Image health5Image ; private String inputMessage ; private boolean highScoreEntered ; private static final int TEXT_X = 164 ; private static final int TEXT_1_Y = 238 ; private static final int TEXT_2_Y = 288 ; private static final int TEXT_3_Y = 338 ; private static final int TEXT_4_Y = 538 ; private static final int BUTTON_X = 150 ; private static final int SAVE_BUTTON_Y = 525 ; private static final int PLAY_BUTTON_Y = 575 ; private static final int MENU_BUTTON_Y = 625 ; private static final int EXIT_BUTTON_Y = 675 ; private static final int HIGHSCORES_X = 1000 ; private static final int BUTTON_WIDTH = 1000 ; private static final int BUTTON_HEIGHT = 50 ; private static final int MOUSE_OVER_RECT_X = 500 ; private static final int TEXT_FIELD_X = 164 ; private static final int TEXT_FIELD_Y = 438 ; private static final int TEXT_FIELD_WIDTH = 700 ; private static final int TEXT_FIELD_HEIGHT = 60 ; private static final int TF_BACKGROUND_DEVIATION = 27 ; private static final int HEALTH_IMAGE_THREE = 3 ; private static final int HEALTH_IMAGE_FOUR = 4 ; private static final int HEALTH_IMAGE_FIVE = 5 ; private static final int LOGO_X = 160 ; private static final int LOGO_Y = 110 ; private static final int SEPARATOR_X = 164 ; private static final int SEPARATOR_Y = 190 ; private static final int BOTTOM_TEXT_OFFSET_X = 250 ; private static final int BOTTOM_TEXT_OFFSET_Y = 75 ; private static final int MAX_NAME_LENGTH = 34 ; private int displayLives ; public GameOverState ( MainGame mainGame ) { } public void init ( GameContainer container , StateBasedGame arg1 ) throws SlickException { } private void initHealthImages ( ) throws SlickException { } @ Override public void enter ( GameContainer container , StateBasedGame sbg ) { } public void exit ( GameContainer container , StateBasedGame sbg , int delta ) { if ( mainGame . getShouldSwitchState ( ) ) { if ( ( RND . getOpacity ( ) ) > 0.0F ) { int fadeTimer = mainGame . getOpacityFadeTimer ( ) ; if ( ( mainGame . getSwitchState ( ) ) == ( - 1 ) ) { fadeTimer = ( ( 2 * 2 ) * 2 ) * fadeTimer ; } RND . setOpacity ( ( ( RND . getOpacity ( ) ) - ( ( ( float ) ( delta ) ) // fadeTimer ) ) ) ; } else { if ( ( mainGame . getSwitchState ( ) ) == ( - 1 ) ) { <START_BUG> mainGame . closeRequested ( ) ; <END_BUG> } else { sbg . enterState ( mainGame . getSwitchState ( ) ) ; } } } } public void update ( GameContainer container , StateBasedGame sbg , int delta ) throws SlickException { } private void handleTextField ( Input input ) { } public void render ( GameContainer container , StateBasedGame arg1 , Graphics graphics ) throws SlickException { } private void renderLives ( Graphics graphics ) { } private void renderButtons ( GameContainer container , Graphics graphics ) { } private void drawButtonMouseOvers ( Input input , Graphics graphics ) { } private void saveScore ( ) { } @ Override public int getID ( ) { } }

Fix:
System . exit ( 0 ) ;