Question

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?

Was it helpful?

Solution

"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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top