public void addListener(Listener listener) { slider.addListener( SWT.Selection, listener ); }
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection,typedListener); addListener (SWT.DefaultSelection,typedListener);
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection,typedListener); addListener (SWT.DefaultSelection,typedListener);
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener(listener); addListener(SWT.Selection,typedListener); addListener(SWT.DefaultSelection,typedListener);
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection,typedListener); addListener (SWT.DefaultSelection,typedListener);
/** * Adds the listener to the collection of listeners who will be notified when * the user changes the receiver's value, by sending it one of the messages * defined in the <code>SelectionListener</code> interface. * <p> * <code>widgetSelected</code> is called when the user changes the receiver's * value. <code>widgetDefaultSelected</code> is not called. * </p> * * @param listener the listener which should be notified * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @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> * @see SelectionListener * @see #removeSelectionListener */ 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.DefaultSelection, typedListener ); }
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection,typedListener); addListener (SWT.DefaultSelection,typedListener);
public EventBased(Composite parent, int initialValue) { super(parent, initialValue); this.value = initialValue; inputField.addListener(SWT.Modify, e -> { try { int parsed = Integer.parseInt(inputField.getText()); setValue(parsed); } catch (Exception error) { outputField.setText(msgForError(error)); } }); scale.addListener(SWT.Selection, e -> { setValue(scale.getSelection()); }); }
privacy_scale.addListener( SWT.Selection, new Listener()
scale.setMaximum(SCALE_MAX); Layouts.setGridData(scale).grabHorizontal().horizontalSpan(3); scale.addListener(SWT.Selection, event -> { double value = mapping.scaleToValue(scale.getSelection()); box.set(value);
public FrpBased(Composite parent, int initialValue) { super(parent, initialValue); value = BehaviorSubject.create(initialValue); RxBox<String> rwText = SwtRx.textImmediate(inputField); Rx.subscribe(rwText, text -> { try { int parsed = Integer.parseInt(text); value.onNext(parsed); } catch (Exception error) { outputField.setText(msgForError(error)); } }); scale.addListener(SWT.Selection, e -> { value.onNext(scale.getSelection()); }); Rx.subscribe(value.map(Object::toString), rwText::set); Rx.subscribe(value.map(this::msgForValue), outputField::setText); Rx.subscribe(value, scale::setSelection); }
scale.setMaximum(255); Rx.subscribe(luminance, scale::setSelection); scale.addListener(SWT.Selection, e -> { luminance.set(scale.getSelection()); });
@Test public void testControl() { InteractiveTest.testCoat("Should show the YCbCr plane at various values of Y", cmp -> { Layouts.setGrid(cmp); Scale scale = new Scale(cmp, SWT.HORIZONTAL); scale.setMinimum(0); scale.setMaximum(255); scale.setSelection(128); Layouts.setGridData(scale).grabHorizontal(); ColorPicker colors = new ColorPicker(cmp); Layouts.setGridData(colors).grabAll(); scale.addListener(SWT.Selection, e -> { colors.setY(scale.getSelection()); }); }); } }