File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SWT - Mapping key actions (ie Ctrl+S = Save)

 
Ivan Jouikov
Ranch Hand
Posts: 269
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 269
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Omg that did the trick!

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic