本文整理了Java中org.eclipse.swt.widgets.Spinner
类的一些代码示例,展示了Spinner
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner
类的具体详情如下:
包路径:org.eclipse.swt.widgets.Spinner
类名称:Spinner
[英]Instances of this class are selectable user interface objects that allow the user to enter and modify numeric values.
Note that although this class is a subclass of Composite
, it does not make sense to add children to it, or set a layout on it.
Styles: READ_ONLY, WRAP Events: Selection, Modify, Verify
IMPORTANT: This class is not intended to be subclassed.
[中]此类的实例是可选择的用户界面对象,允许用户输入和修改数值。
请注意,尽管该类是Composite
的子类,但向其添加子类或在其上设置布局是没有意义的。
样式:只读、换行事件:选择、修改、验证
重要提示:这个类不是子类。
代码示例来源:origin: pentaho/pentaho-kettle
public void getData() {
if ( !jobEntry.isDummy() ) {
wRepeat.setSelection( jobEntry.isRepeat() );
wType.select( jobEntry.getSchedulerType() );
wIntervalSeconds.setSelection( jobEntry.getIntervalSeconds() );
wIntervalMinutes.setSelection( jobEntry.getIntervalMinutes() );
wHour.setSelection( jobEntry.getHour() );
wMinutes.setSelection( jobEntry.getMinutes() );
wDayOfWeek.select( jobEntry.getWeekDay() );
wDayOfMonth.setSelection( jobEntry.getDayOfMonth() );
wType.addSelectionListener( lsDef );
}
wName.setText( jobEntry.getName() );
}
代码示例来源:origin: pentaho/pentaho-kettle
fdlFontSize.right = new FormAttachment( middle, -margin );
wlFontSize.setLayoutData( fdlFontSize );
wFontSize = new Spinner( wNoteFontComp, SWT.BORDER );
wFontSize.setMinimum( 0 );
wFontSize.setMaximum( 70 );
wFontSize.setIncrement( 1 );
fdFontSize = new FormData();
fdFontSize.left = new FormAttachment( middle, 0 );
fdFontSize.top = new FormAttachment( wFontName, margin );
fdFontSize.right = new FormAttachment( 100, -margin );
wFontSize.setLayoutData( fdFontSize );
wFontSize.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent arg0 ) {
refreshTextNote();
代码示例来源:origin: pentaho/pentaho-kettle
private void ok() {
if ( !jobEntry.isDummy() ) {
jobEntry.setRepeat( wRepeat.getSelection() );
jobEntry.setSchedulerType( wType.getSelectionIndex() );
jobEntry.setIntervalSeconds( wIntervalSeconds.getSelection() );
jobEntry.setIntervalMinutes( wIntervalMinutes.getSelection() );
jobEntry.setHour( wHour.getSelection() );
jobEntry.setMinutes( wMinutes.getSelection() );
jobEntry.setWeekDay( wDayOfWeek.getSelectionIndex() );
jobEntry.setDayOfMonth( wDayOfMonth.getSelection() );
}
jobEntry.setName( wName.getText() );
dispose();
}
代码示例来源:origin: pentaho/pentaho-kettle
placeControl( shell, BaseMessages.getString( PKG, "JobSpecial.Type.Label" ), wType, wRepeat );
wIntervalSeconds = new Spinner( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
wIntervalSeconds.setMinimum( 0 );
wIntervalSeconds.setMaximum( Integer.MAX_VALUE );
placeControl(
shell, BaseMessages.getString( PKG, "JobSpecial.IntervalSeconds.Label" ), wIntervalSeconds, wType );
wIntervalMinutes = new Spinner( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
wIntervalMinutes.setMinimum( 0 );
wIntervalMinutes.setMaximum( Integer.MAX_VALUE );
placeControl(
shell, BaseMessages.getString( PKG, "JobSpecial.IntervalMinutes.Label" ), wIntervalMinutes,
wHour = new Spinner( time, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
wHour.setMinimum( 0 );
wHour.setMaximum( 23 );
wMinutes = new Spinner( time, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
wMinutes.setMinimum( 0 );
wMinutes.setMaximum( 59 );
placeControl( shell, BaseMessages.getString( PKG, "JobSpecial.TimeOfDay.Label" ), time, wIntervalMinutes );
wDayOfMonth = new Spinner( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
wDayOfMonth.addModifyListener( lsMod );
wDayOfMonth.setMinimum( 1 );
wDayOfMonth.setMaximum( 30 );
placeControl( shell, BaseMessages.getString( PKG, "JobSpecial.DayOfMonth.Label" ), wDayOfMonth, wDayOfWeek );
代码示例来源: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: inspectIT/inspectIT
depthLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
searchDepthSpinner = new Spinner(mainComposite, SWT.BORDER);
searchDepthSpinner.setMinimum(-1);
searchDepthSpinner.setMaximum(Integer.MAX_VALUE);
searchDepthSpinner.setSelection(-1);
searchDepthSpinner.setIncrement(1);
searchDepthSpinner.setPageIncrement(100);
searchDepthSpinner.setEnabled(false);
searchDepthSpinner.setToolTipText("A value of -1 means that no limit for the search depth is used!");
searchDepthSpinner.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
searchDepthSpinner.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
代码示例来源:origin: org.eclipse/org.eclipse.ui.editors
labelControl.setLayoutData(gd);
final Spinner spinner= new Spinner(composite, SWT.READ_ONLY | SWT.BORDER);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
spinner.setLayoutData(gd);
spinner.setToolTipText(preference.getDescription());
spinner.setMinimum(domain.getMinimumValue().getIntValue());
spinner.setMaximum(domain.getMaximumValue().getIntValue());
spinner.setIncrement(1);
spinner.setPageIncrement(4);
spinner.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int index= spinner.getSelection();
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
lineWidthSpinner = new Spinner(comp, SWT.BORDER | SWT.WRAP);
lineWidthSpinner.setSelection(10);
lineWidthSpinner.setMinimum(1);
lineWidthSpinner.setMaximum(30);
lineWidthSpinner.addListener(SWT.Selection, event -> example.redraw());
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* 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
*/
void addVerifyListener (VerifyListener listener) {
checkWidget();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Verify, typedListener);
}
代码示例来源:origin: org.xworker/xworker_swt
Spinner spinner = new Spinner(parent, style);
spinner.setDigits(self.getInt("digits", 0));
spinner.setIncrement(self.getInt("increment", 1));
String maximum = self.getString("maximum");
if(maximum != null && !"".equals(maximum))
spinner.setMaximum(self.getInt("maximum", 1000000));
String minimun = self.getString("minimun");
if(minimun != null && !"".equals(minimun))
spinner.setMinimum(self.getInt("maximum", -100000));
String pageIncrement = self.getString("pageIncrement");
if(pageIncrement != null && !"".equals(pageIncrement))
spinner.setPageIncrement(self.getInt("pageIncrement", 10));
String selection = self.getString("selection");
if(selection != null && !"".equals(selection))
spinner.setSelection(self.getInt("selection", 1));
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
final Spinner spinner = new Spinner(table, SWT.BORDER);
spinner.setMinimum(0);
String level = item.getText(1);
int defaultLevel = level.length() == 0 || "default".equals(level) ? 0 : Integer.parseInt(level); //$NON-NLS-1$
spinner.setSelection(defaultLevel);
spinner.addModifyListener(e -> {
int selection1 = spinner.getSelection();
item.setText(1, selection1 == 0 ? "default" //$NON-NLS-1$
: Integer.toString(selection1));
代码示例来源: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.platform/org.eclipse.ui.ide.application
protected void createMaxWorkspacesField(Composite parent) {
final Label maxWorkspacesLabel = new Label(parent, SWT.NONE);
maxWorkspacesLabel.setText(IDEWorkbenchMessages.RecentWorkspacesPreferencePage_NumberOfWorkspaces_label);
maxWorkspacesField = new Spinner(parent, SWT.BORDER);
maxWorkspacesField.setTextLimit(MAX_WORKSPACES_DIGIT_COUNT);
maxWorkspacesField.setMinimum(MIN_WORKSPACS);
maxWorkspacesField.setMaximum(MAX_WORKSPACES);
maxWorkspacesField.setSelection(workspacesData.getRecentWorkspaces().length);
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
private Spinner createSpinner(Composite parent, FormToolkit toolkit) {
Spinner spinner = new Spinner(parent, SWT.BORDER);
spinner.setMinimum(0);
spinner.setMaximum(9999);
toolkit.adapt(spinner, false, false);
return spinner;
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
protected Composite createMaxOccurComp(Composite parent, FormToolkit toolkit) {
fMaxLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_maxOccurLabel);
fMaxLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
Composite comp = toolkit.createComposite(parent);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
GridLayout layout = new GridLayout(3, false);
layout.marginHeight = layout.marginWidth = 0;
comp.setLayout(layout);
comp.setLayoutData(gd);
fMaxOccurSpinner = new Spinner(comp, SWT.BORDER);
fMaxOccurSpinner.setMinimum(1);
fMaxOccurSpinner.setMaximum(999);
fMaxOccurSpinner.setIncrement(1);
fUnboundSelect = toolkit.createButton(comp, PDEUIMessages.AbstractSchemaDetails_unboundedButton, SWT.CHECK);
gd = new GridData();
gd.horizontalIndent = 10;
fUnboundSelect.setLayoutData(gd);
fUnboundSelect.addSelectionListener(widgetSelectedAdapter(e -> {
if (blockListeners())
return;
fMaxOccurSpinner.setEnabled(!fUnboundSelect.getSelection() && isEditableElement());
}));
return comp;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private void createFontSizeGroup( Composite parent ) {
Group result = new Group( parent, SWT.NONE );
result.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
result.setText( RWTMessages.getMessage( "RWT_FontDialogFontSizeTitle" ) );
result.setLayout( new GridLayout() );
spFontSize = new Spinner( result, SWT.BORDER );
spFontSize.setDigits( 0 );
spFontSize.setMinimum( 0 );
spFontSize.setMaximum( 200 );
GridData spinnerData = new GridData( SWT.FILL, SWT.FILL, true, true );
spFontSize.setLayoutData( spinnerData );
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
static Spinner createSpinner(Composite parentComposite, int minValue, int maxValue) {
Spinner spinner= new Spinner(parentComposite, SWT.BORDER);
spinner.setFont(parentComposite.getFont());
spinner.setMinimum(minValue);
spinner.setMaximum(maxValue);
spinner.setLayoutData(createGridData(1, GridData.HORIZONTAL_ALIGN_END, SWT.DEFAULT, 0));
return spinner;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
marginGroup.setLayoutData (new GridData(SWT.FILL, SWT.CENTER, false, false));
new Label(marginGroup, SWT.NONE).setText("marginWidth");
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: stackoverflow.com
spinner.setMaximum(100);
spinner.setMinimum(0);
spinner.setIncrement(10);
spinner.addListener(SWT.Verify, new Listener()
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
private void createServerGroup(Composite tabComposite)
{
Composite serverGroup = createTopComposite(tabComposite, SWT.NONE, 7, -1, false, 1, 1);
createLabel(serverGroup, Messages.configTab_contextPathLabel, 128, SWT.RIGHT, 1, 1);
contextText =
createText(serverGroup, SWT.BORDER, Messages.configTab_contextPathTextTip, -1, -1, 6, 1,
modifyDialogListener);
createLabel(serverGroup, Messages.configTab_portLabel, 128, SWT.RIGHT, 1, 1);
portSpinner =
createSpinner(serverGroup, SWT.BORDER, Messages.configTab_portSpinnerTip, 32, -1, 1, 1,
modifyDialogListener);
portSpinner.setMinimum(0);
portSpinner.setMaximum(65535);
portSpinner.setIncrement(1);
portSpinner.setPageIncrement(1000);
createLabel(serverGroup, "/", 16, SWT.CENTER, 1, 1); //$NON-NLS-1$
httpsPortSpinner =
createSpinner(serverGroup, SWT.BORDER, Messages.configTab_httpProtSpinnerTip, 32, -1, 1, 1,
modifyDialogListener);
httpsPortSpinner.setMinimum(0);
httpsPortSpinner.setMaximum(65535);
httpsPortSpinner.setIncrement(1);
httpsPortSpinner.setPageIncrement(1000);
httpsEnabledButton =
createButton(serverGroup, SWT.CHECK, Messages.configTab_httpsEnableButton,
Messages.configTab_httpsEnableButtonTip, -1, 3, 1, modifyDialogListener);
}
内容来源于网络,如有侵权,请联系作者删除!