@Override
	public void keyPressed(KeyEvent e) {
		switch ((int) e.getKeyCode()) {
		case 38: // up
			if (curDir != Direction.moveToDown)
				newDir = Direction.moveToUp;
			break;
		case 40: // down
			if (curDir != Direction.moveToUp)
				newDir = Direction.moveToDown;
			break;
		case 37: // left
			if (curDir != Direction.moveToRight)
				newDir = Direction.moveToLeft;
			break;
		case 39: // right
			if (curDir != Direction.moveToLeft)
				newDir = Direction.moveToRight;
			break;
		default:
			break;
		}
	}