I want to set an accelerator to a JMenuItem.
Right now I am setting it like this
openFile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
and it's working but I don't want ctrl+o as accelerator. I want 'space' as accelerator but I didn't find any method by which I can generate a KeyStroke corresponding to 'space'.
KeyStroke.getStroke()
either takes a char or (int, int). I didn't find any char corresponding to space also.