Dimitri Missoh
enthusiastic technologist and problem solver

January 25th, 2009

Interested in any key events of an SWT Application?

There is actually a way to achieve that. In an appropriate location of your code add:

Display.getDefault().addFilter(SWT.KeyDown, listener);

where the listener to implement can look like:

1
2
3
4
5
Listener listener = new Listener() {
   public void handleEvent(Event event) {
      // do some amazing things with the event
   }
};

Don’t forget to unregister your listener on dispose.

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word