public void select() { if (currentChoice == 0) { gsm.setState(gsm.getBefore()); } if (currentChoice == 1) { gsm.setStateRestart(gsm.getBefore()); } if (currentChoice == 2) { // } if (currentChoice == 3) { gsm.newGame(); } }
@Override public void keyPressed(int k) { if (k == KeyEvent.VK_ENTER) { select(); } if (k == KeyEvent.VK_UP) { currentChoice--; if (currentChoice == -1) { currentChoice = options.length - 1; } } if (k == KeyEvent.VK_DOWN) { currentChoice++; if (currentChoice == options.length) { currentChoice = 0; } } if (k == KeyEvent.VK_ESCAPE) { gsm.newGame(); } }