I wrote a program that moves a gun left and right across a JPanel in response to the user pressing the left and right arrow keys. The program also fires bullets at falling objects by pressing the spacebar.
If I am gliding right or left with the arrow keys and then press the spacebar to fire, the arrow key stops responding. My program will only respond to the arrow key OR the spacebar, but not both at the same time (as if one looses focus when I press the other).
How can I have the program respond to the arrow key and the spacebar simultaneously? I tried removing setFocusable(true) and it didn't help.