문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top