int kc = e.getKeyCode(); if (kc == KeyEvent.VK_N) { newGame(); return; } if (kc == KeyEvent.VK_P) { flipPause(); return; } if (!isUp() || pause) return; switch (e.getKeyCode()) { case KeyEvent.VK_UP: rot(1); break; case KeyEvent.VK_LEFT: trans(-1); break; case KeyEvent.VK_DOWN: rot(3); break; case KeyEvent.VK_RIGHT: trans(1); break; case KeyEvent.VK_SPACE: fall(); break; case KeyEvent.VK_N: newGame(); break; case KeyEvent.VK_P: flipPause(); break; default: return; } repaint(); }
int kc = e.getKeyCode(); if (kc == KeyEvent.VK_N) { newGame(); return; } if (kc == KeyEvent.VK_P) { flipPause(); return; } if (!isUp() || pause) return; switch (e.getKeyCode()) { case KeyEvent.VK_UP: rot(1); break; case KeyEvent.VK_LEFT: trans(-1); break; case KeyEvent.VK_DOWN: rot(3); break; case KeyEvent.VK_RIGHT: trans(1); break; case KeyEvent.VK_SPACE: fall(); break; case KeyEvent.VK_N: newGame(); break; case KeyEvent.VK_P: flipPause(); break; default: return; } SwingUtilities.invokeLater(runRepaint); }
	public void keyPressed(KeyEvent e) {		int kc = e.getKeyCode();		if (kc == KeyEvent.VK_N) {			newGame();			return;		}		if (kc == KeyEvent.VK_P) {			flipPause();			return;		}		if (!isUp() || pause)			return;		switch (e.getKeyCode()) {		case KeyEvent.VK_UP:			rot(1);			break;		case KeyEvent.VK_LEFT:			trans(-1);			break;		case KeyEvent.VK_DOWN:			rot(3);			break;		case KeyEvent.VK_RIGHT:			trans(1);			break;		case KeyEvent.VK_SPACE:			fall();			break;		case KeyEvent.VK_N:			newGame();			break;		case KeyEvent.VK_P:			flipPause();			break;		default:			return;		}		repaint();	}