Sure, implement something like the following:
1 2 3 4 5 6 7 8 9 10 11 12
| boolean F12_DOWN = false ;
if(Keyboard.isKeyDown(Keyboard.KEY_F12)) { if(F12_DOWN == false) { F12_DOWN = true ; swapLighting() ; } } else F12_DOWN = false ; |
This is kind of what I had. The thing is, if your game does 200 FPS (...9700 Pro

) and you push the button for 1/4 second, the F12_DOWN variable has switched on and off about 50 times. It is not guaranteed to be the opposite of the state it was when you pushed the key.
Cas... how does the buffer state help? Can I detect in the buffer the key being pushed, followed by it being released?