本文整理了Java中org.eclipse.swt.widgets.Spinner.addSelectionListener()
方法的一些代码示例,展示了Spinner.addSelectionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.addSelectionListener()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Spinner
类名称:Spinner
方法名:addSelectionListener
[英]Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in the SelectionListener
interface.
widgetSelected
is not called for texts. widgetDefaultSelected
is typically called when ENTER is pressed in a single-line text.
[中]通过发送SelectionListener
界面中定义的消息之一,将侦听器添加到侦听器集合中,当用户选择控件时,将通知这些侦听器。widgetSelected
不需要短信。在单行文本中按ENTER键时通常会调用widgetDefaultSelected
。
代码示例来源:origin: pentaho/pentaho-kettle
fdFontSize.right = new FormAttachment( 100, -margin );
wFontSize.setLayoutData( fdFontSize );
wFontSize.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent arg0 ) {
refreshTextNote();
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private NumberPreference(Spinner spinner, String label, String key) {
super(spinner, label, key, FilteredPreferenceTree.SPINNER_VALUE_MATCHER);
spinner.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateValue();
}
});
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private void addChangeListeners() {
SelectionListener selectionListener = new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent event ) {
updateFontData();
}
};
spFontSize.addSelectionListener( selectionListener );
cbBold.addSelectionListener( selectionListener );
cbItalic.addSelectionListener( selectionListener );
txtFontFamily.addModifyListener( new ModifyListener() {
@Override
public void modifyText( ModifyEvent event ) {
String text = txtFontFamily.getText();
selectFontFamilyInList( text );
updateFontData();
}
} );
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
protected Spinner createControl(Composite parent) {
GridLayout layout= new GridLayout(2, false);
layout.marginWidth= layout.marginHeight= 0;
parent.setLayout(layout);
fLabel= createLabel(1, parent, "", 0); //$NON-NLS-1$
Spinner spinner= createSpinner(parent, minValue, maxValue);
spinner.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int selected= fControl.getSelection();
for (NumberPreference pref : findPreferences(NumberPreference.class)) {
pref.getControl().setSelection(selected);
pref.updateValue();
}
prepareControl();
}
});
return spinner;
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
protected void hookMaxOccur(SelectionListener adapter) {
fUnboundSelect.addSelectionListener(adapter);
fMaxOccurSpinner.addSelectionListener(adapter);
fMaxOccurSpinner.addModifyListener(e -> {
if (blockListeners())
return;
int maxValue = fMaxOccurSpinner.getSelection();
if (maxValue < getMinOccur())
fMaxOccurSpinner.setSelection(maxValue + 1);
});
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
marginWidth = new Spinner(marginGroup, SWT.BORDER);
marginWidth.setSelection(0);
marginWidth.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginHeight");
marginHeight = new Spinner(marginGroup, SWT.BORDER);
marginHeight.setSelection(0);
marginHeight.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
marginHeight.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText ("spacing");
spacing = new Spinner(marginGroup, SWT.BORDER);
spacing.setSelection(0);
spacing.addSelectionListener(selectionListener);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
marginWidth = new Spinner(marginGroup, SWT.BORDER);
marginWidth.setSelection(0);
marginWidth.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginHeight");
marginHeight = new Spinner(marginGroup, SWT.BORDER);
marginHeight.setSelection(0);
marginHeight.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
marginHeight.addSelectionListener(selectionListener);
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
protected void hookMinOccur(SelectionListener adapter) {
fMinOccurSpinner.addSelectionListener(adapter);
fMinOccurSpinner.addModifyListener(e -> {
if (blockListeners())
return;
int minOccur = fMinOccurSpinner.getSelection();
if (minOccur > getMaxOccur())
fMinOccurSpinner.setSelection(minOccur - 1);
});
}
代码示例来源:origin: org.eclipse/org.eclipse.ui.editors
spinner.setPageIncrement(4);
spinner.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int index= spinner.getSelection();
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the minimum
* attribute of the example widget.
*/
void createMinimumGroup() {
/* Create the group */
Group minimumGroup = new Group (controlGroup, SWT.NONE);
minimumGroup.setLayout (new GridLayout ());
minimumGroup.setText (ControlExample.getResourceString("Minimum"));
minimumGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create a Spinner widget */
minimumSpinner = new Spinner (minimumGroup, SWT.BORDER);
minimumSpinner.setMaximum (100000);
minimumSpinner.setSelection(getDefaultMinimum());
minimumSpinner.setPageIncrement (100);
minimumSpinner.setIncrement (1);
minimumSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
minimumSpinner.addSelectionListener (widgetSelectedAdapter(event -> setWidgetMinimum ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the page increment
* attribute of the example widget.
*/
void createPageIncrementGroup() {
/* Create the group */
Group pageIncrementGroup = new Group (controlGroup, SWT.NONE);
pageIncrementGroup.setLayout (new GridLayout ());
pageIncrementGroup.setText (ControlExample.getResourceString("Page_Increment"));
pageIncrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
pageIncrementSpinner = new Spinner (pageIncrementGroup, SWT.BORDER);
pageIncrementSpinner.setMaximum (100000);
pageIncrementSpinner.setSelection (getDefaultPageIncrement());
pageIncrementSpinner.setPageIncrement (100);
pageIncrementSpinner.setIncrement (1);
pageIncrementSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
pageIncrementSpinner.addSelectionListener (widgetSelectedAdapter(event -> setWidgetPageIncrement ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the thumb
* attribute of the example widget.
*/
void createThumbGroup() {
/* Create the group */
Group thumbGroup = new Group (controlGroup, SWT.NONE);
thumbGroup.setLayout (new GridLayout ());
thumbGroup.setText (ControlExample.getResourceString("Thumb"));
thumbGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
thumbSpinner = new Spinner (thumbGroup, SWT.BORDER);
thumbSpinner.setMaximum (100000);
thumbSpinner.setSelection (getDefaultThumb());
thumbSpinner.setPageIncrement (100);
thumbSpinner.setIncrement (1);
thumbSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
thumbSpinner.addSelectionListener (widgetSelectedAdapter(event -> setWidgetThumb ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the increment
* attribute of the example widget.
*/
void createIncrementGroup() {
/* Create the group */
Group incrementGroup = new Group (controlGroup, SWT.NONE);
incrementGroup.setLayout (new GridLayout ());
incrementGroup.setText (ControlExample.getResourceString("Increment"));
incrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
incrementSpinner = new Spinner (incrementGroup, SWT.BORDER);
incrementSpinner.setMaximum (100000);
incrementSpinner.setSelection (getDefaultIncrement());
incrementSpinner.setPageIncrement (100);
incrementSpinner.setIncrement (1);
incrementSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
incrementSpinner.addSelectionListener (widgetSelectedAdapter(e -> setWidgetIncrement ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the page increment
* attribute of the example widget.
*/
void createPageIncrementGroup() {
/* Create the group */
Group pageIncrementGroup = new Group (controlGroup, SWT.NONE);
pageIncrementGroup.setLayout (new GridLayout ());
pageIncrementGroup.setText (ControlExample.getResourceString("Page_Increment"));
pageIncrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
pageIncrementSpinner = new Spinner (pageIncrementGroup, SWT.BORDER);
pageIncrementSpinner.setMaximum (100000);
pageIncrementSpinner.setSelection (getDefaultPageIncrement());
pageIncrementSpinner.setPageIncrement (100);
pageIncrementSpinner.setIncrement (1);
pageIncrementSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
pageIncrementSpinner.addSelectionListener (widgetSelectedAdapter(event -> setWidgetPageIncrement ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the maximum
* attribute of the example widget.
*/
void createMaximumGroup() {
/* Create the group */
Group maximumGroup = new Group (controlGroup, SWT.NONE);
maximumGroup.setLayout (new GridLayout ());
maximumGroup.setText (ControlExample.getResourceString("Maximum"));
maximumGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create a Spinner widget */
maximumSpinner = new Spinner (maximumGroup, SWT.BORDER);
maximumSpinner.setMaximum (100000);
maximumSpinner.setSelection (getDefaultMaximum());
maximumSpinner.setPageIncrement (100);
maximumSpinner.setIncrement (1);
maximumSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
maximumSpinner.addSelectionListener(widgetSelectedAdapter(event -> setWidgetMaximum ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the increment
* attribute of the example widget.
*/
void createIncrementGroup() {
/* Create the group */
Group incrementGroup = new Group (controlGroup, SWT.NONE);
incrementGroup.setLayout (new GridLayout ());
incrementGroup.setText (ControlExample.getResourceString("Increment"));
incrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
incrementSpinner = new Spinner (incrementGroup, SWT.BORDER);
incrementSpinner.setMaximum (100000);
incrementSpinner.setSelection (getDefaultIncrement());
incrementSpinner.setPageIncrement (100);
incrementSpinner.setIncrement (1);
incrementSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
incrementSpinner.addSelectionListener (widgetSelectedAdapter(e -> setWidgetIncrement ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the digits
* attribute of the example widget.
*/
void createDigitsGroup() {
/* Create the group */
Group digitsGroup = new Group (controlGroup, SWT.NONE);
digitsGroup.setLayout (new GridLayout ());
digitsGroup.setText (ControlExample.getResourceString("Digits"));
digitsGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
digitsSpinner = new Spinner (digitsGroup, SWT.BORDER);
digitsSpinner.setMaximum (100000);
digitsSpinner.setSelection (getDefaultDigits());
digitsSpinner.setPageIncrement (100);
digitsSpinner.setIncrement (1);
digitsSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
digitsSpinner.addSelectionListener (widgetSelectedAdapter(e -> setWidgetDigits ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the increment
* attribute of the example widget.
*/
void createIncrementGroup() {
/* Create the group */
Group incrementGroup = new Group (controlGroup, SWT.NONE);
incrementGroup.setLayout (new GridLayout ());
incrementGroup.setText (ControlExample.getResourceString("Increment"));
incrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
incrementSpinner = new Spinner (incrementGroup, SWT.BORDER);
incrementSpinner.setMaximum (100000);
incrementSpinner.setSelection (getDefaultIncrement());
incrementSpinner.setPageIncrement (100);
incrementSpinner.setIncrement (1);
incrementSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
incrementSpinner.addSelectionListener (widgetSelectedAdapter(e -> setWidgetIncrement ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the page increment
* attribute of the example widget.
*/
void createPageIncrementGroup() {
/* Create the group */
Group pageIncrementGroup = new Group (controlGroup, SWT.NONE);
pageIncrementGroup.setLayout (new GridLayout ());
pageIncrementGroup.setText (ControlExample.getResourceString("Page_Increment"));
pageIncrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
/* Create the Spinner widget */
pageIncrementSpinner = new Spinner (pageIncrementGroup, SWT.BORDER);
pageIncrementSpinner.setMaximum (100000);
pageIncrementSpinner.setSelection (getDefaultPageIncrement());
pageIncrementSpinner.setPageIncrement (100);
pageIncrementSpinner.setIncrement (1);
pageIncrementSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
pageIncrementSpinner.addSelectionListener (widgetSelectedAdapter(event -> setWidgetPageIncrement ()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Create a group of widgets to control the selection
* attribute of the example widget.
*/
void createSelectionGroup() {
/* Create the group */
Group selectionGroup = new Group(controlGroup, SWT.NONE);
selectionGroup.setLayout(new GridLayout());
GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, false, false);
selectionGroup.setLayoutData(gridData);
selectionGroup.setText(ControlExample.getResourceString("Selection"));
/* Create a Spinner widget */
selectionSpinner = new Spinner (selectionGroup, SWT.BORDER);
selectionSpinner.setMaximum (100000);
selectionSpinner.setSelection (getDefaultSelection());
selectionSpinner.setPageIncrement (100);
selectionSpinner.setIncrement (1);
selectionSpinner.setLayoutData (new GridData (SWT.FILL, SWT.CENTER, true, false));
/* Add the listeners */
selectionSpinner.addSelectionListener(widgetSelectedAdapter(event -> setWidgetSelection ()));
}
内容来源于网络,如有侵权,请联系作者删除!