so i have a simple typing game where the user clicks the start button and 10 random words appear at the top of the screen. The user then has to enter these words into the texbox and press the space bar to move onto the next word. When the user is finished typing the words a message box appears saying how many errors were made.
my problem is if the user doesn't press the start button and just starts typing in the textbox and presses the space bar the words start to change at the top of the screen. i only want the words to change if the start button has been pressed.
heres the code to change the words:
so basically i just need code that checks if the start button has been pressed then do the code above else don't do that codeCode:
int code = evt.getKeyCode();
if(code==evt.VK_SPACE) //moves to next word if space is pressed
JOptionPane.showMessageDialog(this, this.errorCount, "Game over! Errors made: ", JOptionPane.INFORMATION_MESSAGE);
//check for errors