i need to know the state of shift and fn(alt) on physical keyboard when they are pressed or get locked.
i know the KeyEvent
class have methods like isAltPressed()
and isShiftPressed()
, this works fine when shift or fn pressed one time, but when they pressed twice and get locked i can not find out if this key is locked or not.
also the getMetaState()
return 0 when shift or fn is locked and i press another key like p
so is there any method like isShiftLocked()
or isAltLocked()
or something like this ?
since there is no method that do this for me i must keep track of shift and fn manually. when onKeyDown()
method get called, i can check for shift or fn keycode
and if they pressed, boolean variables such as shiftPressed
or shiftLocked
will be updated.