private void startListening() { server_.addListener(SWT.Selection,this); runtime_.addListener(SWT.Selection,this); }
public void addListener(Listener listener) { dropDownList.addListener( SWT.Modify, listener ); dropDownList.addListener( SWT.Selection, listener ); }
/** * Sets up control listeners. */ private void setupListeners() { pageCompletionListener = new Listener() { @Override public void handleEvent(Event event) { setPageComplete(isPageComplete()); setPageMessage(); } }; Listener measurementChangedListener = new Listener() { @Override public void handleEvent(Event event) { updateFieldOptions(); for (TagKeyValueUIComponent tagComponent : tagComponents) { tagComponent.updateTagKeyOptions(); } } }; nameBox.addListener(SWT.Modify, pageCompletionListener); measurementBox.addListener(SWT.Modify, pageCompletionListener); fieldBox.addListener(SWT.Modify, pageCompletionListener); measurementBox.addListener(SWT.Modify, measurementChangedListener); }
private void addListeners() { aliasField.addListener(SWT.KeyUp, this); trustEngineCombo.addListener(SWT.Selection, this); }
private void addListeners() { aliasField.addListener(SWT.KeyUp, this); trustEngineCombo.addListener(SWT.Selection, this); }
@Override public boolean addSelectionListener(final SelectionListener selectionListener) { fCombo.addSelectionListener(selectionListener); Listener listener= new Listener() { /* * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) */ @Override public void handleEvent(Event e) { selectionListener.widgetSelected(new SelectionEvent(e)); } }; fCombo.addListener(SWT.Modify, listener); fModifyListeners.put(selectionListener, listener); return true; }
@Override public boolean addSelectionListener(final SelectionListener selectionListener) { fCombo.addSelectionListener(selectionListener); Listener listener= new Listener() { /* * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) */ @Override public void handleEvent(Event e) { selectionListener.widgetSelected(new SelectionEvent(e)); } }; fCombo.addListener(SWT.Modify, listener); fModifyListeners.put(selectionListener, listener); return true; }
private void createLaunchConfigSelectionGroup(Composite parent) { fLaunchConfigurationCombo= new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(fLaunchConfigurationCombo); fLaunchConfigurationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fLauchConfigurationModel.addAll(Arrays.asList(getLaunchConfigurations())); String[] names= new String[fLauchConfigurationModel.size()]; for (int i= 0, size= fLauchConfigurationModel.size(); i < size; i++) { LaunchConfigurationElement element= fLauchConfigurationModel.get(i); names[i]= element.getLaunchConfigurationName(); } fLaunchConfigurationCombo.setItems(names); fLaunchConfigurationCombo.addListener(SWT.Selection, this); fLaunchConfigurationCombo.addListener(SWT.Modify, this); }
private void createLaunchConfigSelectionGroup(Composite parent) { fLaunchConfigurationCombo= new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(fLaunchConfigurationCombo); fLaunchConfigurationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fLauchConfigurationModel.addAll(Arrays.asList(getLaunchConfigurations())); String[] names= new String[fLauchConfigurationModel.size()]; for (int i= 0, size= fLauchConfigurationModel.size(); i < size; i++) { LaunchConfigurationElement element= fLauchConfigurationModel.get(i); names[i]= element.getLaunchConfigurationName(); } fLaunchConfigurationCombo.setItems(names); fLaunchConfigurationCombo.addListener(SWT.Selection, this); fLaunchConfigurationCombo.addListener(SWT.Modify, this); }
private void createLaunchConfigSelectionGroup(Composite parent) { fLaunchConfigurationCombo= new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(fLaunchConfigurationCombo); fLaunchConfigurationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fLauchConfigurationModel.addAll(Arrays.asList(getLaunchConfigurations())); String[] names= new String[fLauchConfigurationModel.size()]; for (int i= 0, size= fLauchConfigurationModel.size(); i < size; i++) { LaunchConfigurationElement element= fLauchConfigurationModel.get(i); names[i]= element.getLaunchConfigurationName(); } fLaunchConfigurationCombo.setItems(names); fLaunchConfigurationCombo.addListener(SWT.Selection, this); fLaunchConfigurationCombo.addListener(SWT.Modify, this); }
@Override public void createControlPanel(Composite parent) { new Label(parent, SWT.NONE).setText(GraphicsExample.getResourceString("FillRule")); //$NON-NLS-1$ fillRuleCb = new Combo(parent, SWT.DROP_DOWN); fillRuleCb.add("FILL_EVEN_ODD"); fillRuleCb.add("FILL_WINDING"); fillRuleCb.select(0); fillRuleCb.addListener(SWT.Selection, event -> example.redraw()); }
public static void main(String[] args) { Display d = new Display(); final Shell shell = new Shell(d); shell.setLayout(new GridLayout(1, false)); new Label(shell, SWT.NONE).setText("Bet type:"); final Combo betType = new Combo(shell, SWT.SINGLE | SWT.BORDER); betType.setItems(new String[] {" ", "NFL", "NBA", "CFB"}); betType.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event arg0) { System.out.println(betType.getText()); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) while (!d.readAndDispatch()) d.sleep(); }
/** * Adds the listener to the collection of listeners who will * be notified when the receiver's text is modified, by sending * it one of the messages defined in the <code>ModifyListener</code> * interface. * * @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 ModifyListener * @see #removeModifyListener */ public void addModifyListener (ModifyListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Modify, typedListener); }
/** * Adds the listener to the collection of listeners who will * be notified when the receiver's text is modified, by sending * it one of the messages defined in the <code>ModifyListener</code> * interface. * * @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 ModifyListener * @see #removeModifyListener */ public void addModifyListener (ModifyListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Modify, typedListener); }
/** * Adds the listener to the collection of listeners who will * be notified when the receiver's text is verified, by sending * it one of the messages defined in the <code>VerifyListener</code> * interface. * * @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 VerifyListener * @see #removeVerifyListener * * @since 3.1 */ public void addVerifyListener (VerifyListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Verify, typedListener); }
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(1, true)); final Combo combo = new Combo(shell, SWT.NONE); combo.addListener(SWT.KeyUp, new Listener() { @Override public void handleEvent(Event arg0) { if(arg0.character == SWT.CR) MessageDialog.openInformation(shell, "Input", "You entered: " + combo.getText()); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
protected Control createText(final Composite parent, final int style) { title = new Combo(parent, style | SWT.DROP_DOWN); final String text = rule.getText(); title.setText(text); loadHistory(); if (text != null && text.length() > 0 && result.length == 0) setBackground(false); title.addModifyListener(modifyListener); title.addListener(SWT.KeyDown, new Listener() { public void handleEvent(Event event) { GlanceEventDispatcher.INSTANCE.dispatchKeyPressed(event); } }); title.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); title.setEnabled(titleEnabled); return title; }
@Override public void createControlPanel(Composite parent) { Composite comp; GridLayout gridLayout = new GridLayout(2, false); // create drop down combo comp = new Composite(parent, SWT.NONE); comp.setLayout(gridLayout); new Label(comp, SWT.CENTER).setText(GraphicsExample .getResourceString("Image")); //$NON-NLS-1$ imageCb = new Combo(comp, SWT.DROP_DOWN); imageCb.add(GraphicsExample.getResourceString("House")); //$NON-NLS-1$ imageCb.add(GraphicsExample.getResourceString("Question")); //$NON-NLS-1$ imageCb.add(GraphicsExample.getResourceString("Task")); //$NON-NLS-1$ imageCb.add(GraphicsExample.getResourceString("Font")); //$NON-NLS-1$ imageCb.add(GraphicsExample.getResourceString("Cube")); //$NON-NLS-1$ imageCb.add(GraphicsExample.getResourceString("SWT")); //$NON-NLS-1$ imageCb.add(GraphicsExample.getResourceString("Ovals")); //$NON-NLS-1$ imageCb.select(0); imageCb.addListener(SWT.Selection, event -> example.redraw()); }
/** * Populates a Combo and bidirectionally binds it to an `RxBox<T>`. * * @param combo The combo which is being bound. * @param values The values which the RxBox can take on. * @param converter A function for mapping values to strings. * @param values The values which the RxBox can take on. * @return An `RxBox<T>` which will be bound bidirectionally to the given combo. */ public static <T> void combo(Combo combo, ImmutableList<T> values, Function<T, String> converter, RxBox<T> box) { // setup the combo combo.removeAll(); for (T value : values) { combo.add(converter.apply(value)); } // bind it to a box combo.addListener(SWT.Selection, e -> { box.set(values.get(combo.getSelectionIndex())); }); SwtExec.immediate().guardOn(combo).subscribe(box, mdlValue -> { combo.select(values.indexOf(mdlValue)); }); }
public IntListParameter(Composite composite, String configID, String[] labels, int[] values) { super(configID); this.values = values; list = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY); if (labels.length != values.length) { return; } int value = COConfigurationManager.getIntParameter(configID); int index = findIndex(value, values); for (String label : labels) { if (Utils.isGTK) { list.add(label + " "); // Pad to force avoid truncation of selected label in control } else { list.add(label); } } setIndex(index); list.addListener(SWT.Selection, e -> setIndex(list.getSelectionIndex())); }