Get key combination code of multiple keys

后端 未结 2 1734
遥遥无期
遥遥无期 2021-01-02 11:32

I want to ask you can I get key code combination of multiple keys. For example I can get the key code from this example:

<         


        
2条回答
  •  生来不讨喜
    2021-01-02 12:19

    I Don't see directly there is any way except Menus but still We can handle multi key event e.g. Ctrl + S by below work around.

    at controller class level keep

    public static boolean halfCtrlSPressed=false;
    

    and in Event filter add logic as

    if(ke.getCode().getName() == "Ctrl") {
                halfCtrlSPressed=true;
            }else if(ke.getCode().getName() == "S"  && halfCtrlSPressed) {
                halfCtrlSPressed=false;
                //doDomething
    }
    

提交回复
热议问题