public void keyPressed (KeyEvent e) {
        int keyCode = e.getKeyCode ();
        if  (model.running) {
            switch (keyCode) {
                case KeyEvent.VK_UP:
                    model.changeDirection (SnakeModel.UP);
                    break;
                case KeyEvent.VK_DOWN:
                    model.changeDirection (SnakeModel.DOWN);
                    break;
                case KeyEvent.VK_LEFT:
                    model.changeDirection (SnakeModel.LEFT);
                    break;
                case KeyEvent.VK_RIGHT:
                    model.changeDirection (SnakeModel.RIGHT);
                    break;
                case KeyEvent.VK_ADD:
                case KeyEvent.VK_R:
                    model.reset();
                    break;
                case KeyEvent.VK_SPACE:
                case KeyEvent.VK_P:
                    model.changePauseState ();
                    break;
                default:
            }
        }
    }