I am making a program that allows user to custom keyboard shortcuts, for this i need the available keys to be displayed, what is the best way to achieve this in java swing?
KeyEvent.class.getDeclaredFields()
I am intrested in dynamic example of below,
keysLST.setModel(new javax.swing.DefaultComboBoxModel(new String[] { 'CTRL', 'ALT', 'SHIFT' }));
one way i know is to get all from the keyevent class but i am not sure how to integrate it to the list. any help would be appreciated.
Thanks
Instead of picking from a list, add a KeyListener to any component (a JTextField works) and record the key code as the user presses the key. You can also record modifiers (ctrl,alt,shift) this way.