| Author |
SWT - Mapping key actions (ie Ctrl+S = Save)
|
Ivan Jouikov
Ranch Hand
Joined: Jul 22, 2003
Posts: 269
|
|
How the hell do you do that? I spent the last two hours searching google with absolutely no result! shell.addKeyListener( new KeyAdapter ... doesn't work. It works if I add it to a text box, but how would I make a global key listener event? This is driving me crazy, please help
|
 |
Nick Kocher
Greenhorn
Joined: Nov 24, 2004
Posts: 14
|
|
Privet Ivan! If you need Ctrl + s for your menuItem in the menu for example, you could use the following code: menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
|
 |
Ivan Jouikov
Ranch Hand
Joined: Jul 22, 2003
Posts: 269
|
|
Omg that did the trick! Thanks!
|
 |
 |
|
|
subject: SWT - Mapping key actions (ie Ctrl+S = Save)
|
|
|