/** * Adds a selection listener. A Selection event is sent by the widget when * the selection has changed. * <p> * <code>widgetDefaultSelected</code> is not called for FormText. * </p> * * @param listener * the listener * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> * @since 3.1 */ public void addSelectionListener(SelectionListener listener) { checkWidget(); if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } TypedListener typedListener = new TypedListener(listener); addListener(SWT.Selection, typedListener); }
/** * Adds a selection listener. A Selection event is sent by the widget when * the selection has changed. * <p> * <code>widgetDefaultSelected</code> is not called for FormText. * </p> * * @param listener * the listener * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> * @since 3.1 */ public void addSelectionListener(SelectionListener listener) { checkWidget(); if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } TypedListener typedListener = new TypedListener(listener); addListener(SWT.Selection, typedListener); }
addListener(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { addListener(SWT.Traverse, new Listener() { @Override public void handleEvent(Event e) {
}); addPaintListener(e -> paint(e)); addListener(SWT.KeyDown, e -> { if (e.character == '\r') { activateSelectedLink(); addListener(SWT.Traverse, e -> { if (DEBUG_FOCUS) System.out.println("Traversal: " + e); //$NON-NLS-1$