Pergunta

I have two key binds on my code:

private void enterBind(){

    String key = "ENTER";
    KeyStroke keyStroke = KeyStroke.getKeyStroke(key);

    //code  
}

private void altSBind(){

    String key = "VK_S";
    KeyStroke keyStroke = KeyStroke.getKeyStroke(key);

    //code
}

The enter bind is fully working, but the "Alt S" bind is not, I tryed to research what should I insert in the place of "VK_S" but until I got no sucess on it. Is this simple to solve?

Foi útil?

Solução

"alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
"alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);

This might help.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top