keyPressed - when the key goes down
keyReleased - when the key comes up
keyTyped - when the unicode character represented by this key is sent by the keyboard to system input.
I personally would use keyReleased for this. It will fire only when they lift their finger up.
Note that keyTyped will only work for something that can be printed (I don't know if F5 can or not) and I believe will fire over and over again if the key is held down. This would be useful for something like... moving a character across the screen or something.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…