You may be looking for the #addKeyListener method of the Button class. Deploy the KeyListener , and in #keyReleased (KeyEvent keyEvent) evaluate the keyEvent method: if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { //your code here}
source share