Pages

2009-12-31

Capture and handle CTRL + C with SWT


Add the following listener to yor list, table or any other widget:


        private Listener myKeyListener() {
                return new Listener() {
                        public void handleEvent(Event e) {
                                if(!(e.keyCode == 'c' && e.stateMask == SWT.CTRL)) return;
                                System.out.println("CTRL + C");
                               // Do what you want to do now

                        }
                };
        }

That's it!

No comments:

Post a Comment