infinitysquadron
Programmer
Yo, it's me again,
I need a form of taking input from the keyboard, mainly the arrow keys and space bar, that does not inturrupt the program's execution. Basically, the user needs to select something from a menu (using the arrow keys) while other events are happening. I was hoping for a way for the program to 'check' if the user had pressed any keys every few milliseconds, and if not, go about doing the other routines.
I've looked at a few options, but not of which have worked. KeyListeners don't take effect until my program's execution has ended, making it come in a little too late... And the other basic forms of input halt the program in it's traks as well as requiring the enter key to be pressed and other annoying things like that. In QBASIC we used the INKEY$ variable, which held the value of the last key pressed on the keyboard.
Does anyone know a good way of doing this?
I need a form of taking input from the keyboard, mainly the arrow keys and space bar, that does not inturrupt the program's execution. Basically, the user needs to select something from a menu (using the arrow keys) while other events are happening. I was hoping for a way for the program to 'check' if the user had pressed any keys every few milliseconds, and if not, go about doing the other routines.
I've looked at a few options, but not of which have worked. KeyListeners don't take effect until my program's execution has ended, making it come in a little too late... And the other basic forms of input halt the program in it's traks as well as requiring the enter key to be pressed and other annoying things like that. In QBASIC we used the INKEY$ variable, which held the value of the last key pressed on the keyboard.
Does anyone know a good way of doing this?