Key.isLockOn() in java api will lead to java.lang.StackOverflowError

Asked by ikaros on 2017-12-22

I wrote like this:
if (Key.isLockOn(Key.C_CAPS_LOCK)){
            System.out.print("false");
        }else {
            type(Key.CAPS_LOCK);
        }

and it shows error like this:
Exception in thread "main" java.lang.StackOverflowError
 at org.sikuli.util.SysJNA$WinUser32.isCapsLockOn(SysJNA.java:114)
 at org.sikuli.script.Key.isLockOn(Key.java:817)

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
ikaros
Solved:
2017-12-22
Last query:
2017-12-22
Last reply:
ikaros (ikarouse) said : #1

i find it myself,
these code is in a class called type,
i should use this:
Screen screen = new Screen;
 screen.type(Key.CAPS_LOCK);