I am now working on adding some global key shortcuts to my application.
First, I’ve written a method to translate native modifier codes to swing’s modifier codes, added a global native hook, but it did not work. Than, I’ve added a print-statemenet and encountered an unexpected result.
Code:
int m=KeyEvent.SHIFT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK|KeyEvent.ALT_DOWN_MASK;
System.out.println(m+" "+KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT,m).getModifiers());
Output: 704 715
.
So… Why? Why modifiers set are not what getter returns?
I reckon, it should return 704 704
.
Akkaunt 145 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.