//setting key to pause a meathod void keyPressed() { if (key == 'p' || key == 'p') { paused = !paused; } } //use to stop draw(), move(),ect. if(!paused){ }
how to recognize a pressed key in java