当前位置: 首页>>代码示例>>Java>>正文


Java Spinner类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Spinner的典型用法代码示例。如果您正苦于以下问题:Java Spinner类的具体用法?Java Spinner怎么用?Java Spinner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Spinner类属于org.eclipse.swt.widgets包,在下文中一共展示了Spinner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDialogArea

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {		
	
	Composite composite = new Composite(parent, SWT.NONE);
	
	Label labelDescription = new Label(composite, SWT.WRAP);
	labelDescription.setText("Limit chars logs");
	
	final Spinner spinnerBox = new Spinner(composite, SWT.WRAP);
	spinnerBox.setMaximum(MAX_LOG_CHARS);
	spinnerBox.setMinimum(MIN_LOG_CHARS);
	spinnerBox.setSelection(limitLogsChars);
	spinnerBox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	
	spinnerBox.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			limitLogsChars = Integer.parseInt(spinnerBox.getText());
		}
	});
	
	composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	composite.setLayout(new GridLayout(2, false));
	
	return composite;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:27,代码来源:LimitCharsLogsPreferenceDialog.java

示例2: createWidgets

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
@Override
protected void createWidgets(String text, String toolTip, Integer initialValue) {
	lbl = new Label(this, SWT.NONE);
	lbl.setText(text);

	spinner = new Spinner(this, SWT.CHECK);
	spinner.setToolTipText(toolTip);
	spinner.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			Integer value = spinner.getSelection();
			if (value != getValue()) {
				setValue(value, false);
			}
		}
	});
}
 
开发者ID:turnus,项目名称:turnus,代码行数:18,代码来源:WidgetSpinnerInteger.java

示例3: createWidgets

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
@Override
protected void createWidgets(String text, String toolTip, Double initialValue) {
	lbl = new Label(this, SWT.NONE);
	lbl.setText(text);

	spinner = new Spinner(this, SWT.CHECK);
	spinner.setToolTipText(toolTip);
	spinner.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			double value = spinner.getSelection() / scale;
			if (value != getValue()) {
				setValue(value, false);
			}
		}
	});

}
 
开发者ID:turnus,项目名称:turnus,代码行数:19,代码来源:WidgetSpinnerDecimal.java

示例4: getWidget

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
/**
 * Retrieves the control from the viewer
 */
public static Control getWidget(Object control) {
	if (control instanceof Viewer) {
		return ((Viewer) control).getControl();
	} else if (control instanceof Text) {
		return (Text) control;
	} else if (control instanceof Button) {
		return (Control) control;
	} else if (control instanceof Spinner) {
		return (Control) control;
	} else if (control instanceof Control) {
		// why not return the control when object is instanceof control?
		return null;
	}

	return null;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:20,代码来源:UIHelper.java

示例5: setSelectedColor

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
private void setSelectedColor(Control control, boolean selection) {
	if (selection) {
		control.setForeground(control.getParent().getForeground());
		if (!((control instanceof Text) || (control instanceof Combo)
				|| (control instanceof MultiChoice<?>) || (control instanceof Spinner))) {
			control.setBackground(BACKGROUND_COLOR);
		}
	} else {
		control.setForeground(BTSUIConstants.VIEW_FOREGROUND_DESELECTED_COLOR);
		control.setBackground(BTSUIConstants.VIEW_BACKGROUND_DESELECTED_COLOR);

	}

	if (control instanceof Composite) {
		for (Control child : ((Composite) control).getChildren()) {
			setSelectedColor(child, selection);
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:20,代码来源:BTSConfigurationDialog.java

示例6: LinesPerPageDialog

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
private LinesPerPageDialog(Shell parentShell)
{
	shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	shell.setText("Lines per Page");
	shell.setLayout(new GridLayout(3, true));

	spinner = new Spinner(shell, 0);
	spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	spinner.setValues(bzStyledText.getLinesPerPage(), 0, 225, 0, 1, 10);
	spinner.addKeyListener(this);

	okButton = new Button(shell, SWT.PUSH);
	okButton.setText("OK");
	okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	okButton.addSelectionListener(this);

	cancelButton = new Button(shell, SWT.PUSH);
	cancelButton.setText("Cancel");
	cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	cancelButton.addSelectionListener(this);

	shell.pack();
	shell.open();
}
 
开发者ID:MikeGray-APH,项目名称:BrailleZephyr,代码行数:25,代码来源:BZMenu.java

示例7: CharsPerLineDialog

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
private CharsPerLineDialog(Shell parentShell)
{
	shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	shell.setText("Characters Per Line");
	shell.setLayout(new GridLayout(3, true));

	spinner = new Spinner(shell, 0);
	spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	spinner.setValues(bzStyledText.getCharsPerLine(), 0, 27720, 0, 1, 10);
	spinner.addKeyListener(this);

	okButton = new Button(shell, SWT.PUSH);
	okButton.setText("OK");
	okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	okButton.addSelectionListener(this);

	cancelButton = new Button(shell, SWT.PUSH);
	cancelButton.setText("Cancel");
	cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	cancelButton.addSelectionListener(this);

	shell.pack();
	shell.open();
}
 
开发者ID:MikeGray-APH,项目名称:BrailleZephyr,代码行数:25,代码来源:BZMenu.java

示例8: LineMarginBellDialog

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
private LineMarginBellDialog(Shell parentShell)
{
	shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	shell.setText("Bell Margin");
	shell.setLayout(new GridLayout(3, true));

	spinner = new Spinner(shell, 0);
	spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	spinner.setValues(bzStyledText.getLineMarginBell(), 0, 27720, 0, 1, 10);
	spinner.addKeyListener(this);

	okButton = new Button(shell, SWT.PUSH);
	okButton.setText("OK");
	okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	okButton.addSelectionListener(this);

	cancelButton = new Button(shell, SWT.PUSH);
	cancelButton.setText("Cancel");
	cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	cancelButton.addSelectionListener(this);

	shell.pack();
	shell.open();
}
 
开发者ID:MikeGray-APH,项目名称:BrailleZephyr,代码行数:25,代码来源:BZMenu.java

示例9: PageMarginBellDialog

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
private PageMarginBellDialog(Shell parentShell)
{
	shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	shell.setText("Bell Page");
	shell.setLayout(new GridLayout(3, true));

	spinner = new Spinner(shell, 0);
	spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	spinner.setValues(bzStyledText.getPageMarginBell(), 0, 27720, 0, 1, 10);
	spinner.addKeyListener(this);

	okButton = new Button(shell, SWT.PUSH);
	okButton.setText("OK");
	okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	okButton.addSelectionListener(this);

	cancelButton = new Button(shell, SWT.PUSH);
	cancelButton.setText("Cancel");
	cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	cancelButton.addSelectionListener(this);

	shell.pack();
	shell.open();
}
 
开发者ID:MikeGray-APH,项目名称:BrailleZephyr,代码行数:25,代码来源:BZMenu.java

示例10: storeOptionValues

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
public void storeOptionValues() {
  IPreferenceStore store = getPreferenceStore();

  controlMap.forEach((serviceId, optionControlPairs) -> {
    optionControlPairs.forEach(optionControlPair -> {
      Option<?> option = optionControlPair.getLeft();
      Control control = optionControlPair.getRight();
      String storeKey = Activator.getStoreKey(serviceId, option);

      option.matchVoid(booleanOption -> {
        store.setValue(storeKey, ((Button) control).getSelection());
      }, numberOption -> {
        store.setValue(storeKey, ((Spinner) control).getSelection());
      }, textOption -> {
        store.setValue(storeKey, ((Text) control).getText());
      }, xorOption -> {
        store.setValue(storeKey, ((Combo) control).getSelectionIndex());
      }, optionGroup -> {
      });
    });
  });
}
 
开发者ID:monto-editor,项目名称:monto-eclipse,代码行数:23,代码来源:ServiceConfigurationPage.java

示例11: RangeTool

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
/**
 * Construct the {@code RangeTool} UI with the given set of options.
 * 
 * @param parent containing window for range tool
 * @param style basic presentation options
 */
public RangeTool(Composite parent, int style,
    String label, RelationCount.RangeData setup) {
  super(parent, style);

  setLayout(new RowLayout());

  Label rangeLabel = new Label(this, SWT.LEFT);
  rangeLabel.setText(label);

  rangeOp = createRangeOp(setup.option);
  loLabel = new Label(this, SWT.LEFT);
  loLimit = new Spinner(this, style);
  hiLabel = new Label(this, SWT.LEFT);
  hiLimit = new Spinner(this, style);
  setLimits(setup);
}
 
开发者ID:google,项目名称:depan,代码行数:23,代码来源:RelationCountFilterEditorControl.java

示例12: handleDirectionChange

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
private void handleDirectionChange(Spinner input) {

    // Ignore bad input
    float value;
    try {
      String text = input.getText();
      value = Float.parseFloat(text);
    } catch (NumberFormatException e) {
      return;
    }

    if (xdirInput.isControl(input)) {
      fireXChanged(value);
    } else if (ydirInput.isControl(input)) {
      fireYChanged(value);
    } else if (zdirInput.isControl(input)) {
      fireZChanged(value);
    }
  }
 
开发者ID:google,项目名称:depan,代码行数:20,代码来源:CameraDirectionGroup.java

示例13: handlePositionChange

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
private void handlePositionChange(Spinner input) {

    // Ignore bad input
    float value;
    try {
      String text = input.getText();
      value = Float.parseFloat(text);
    } catch (NumberFormatException e) {
      return;
    }

    if (xposInput.isControl(input)) {
      fireXChanged(value);
    } else if (yposInput.isControl(input)) {
      fireYChanged(value);
    } else if (zposInput.isControl(input)) {
      fireZChanged(value);
    }
  }
 
开发者ID:google,项目名称:depan,代码行数:20,代码来源:CameraPositionGroup.java

示例14: refresh

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
@Override
public void refresh() {

  final String value = getSimpleValueOrDefault();

  if (StringUtils.isNotEmpty(value)) {

    for (final Control childControl : periodControl.getChildren()) {
      if (childControl instanceof Spinner) {
        Spinner actualControl = (Spinner) childControl;
        String periodKey = (String) childControl.getData("PERIOD_KEY");
        PeriodPropertyElement element = PeriodPropertyElement.byShortFormat(periodKey);
        if (element != null) {
          actualControl.setSelection(ExtensionPropertyUtil.getPeriodPropertyElementFromValue(value, element));
        }
      }
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:CustomPropertyPeriodField.java

示例15: createRadio

import org.eclipse.swt.widgets.Spinner; //导入依赖的package包/类
/**
 * Create a radio button followed by a spinner with a maximum and a minimum value. At the radio 
 * button can be associated a governor. This object define how the color picker area is painted.
 * This is done because when a button is selected its governor is set into the color picker widget
 * changing the color space. When a radio button created with this method is selected all the other
 * are deselected.
 * 
 * @param parent parent of the controls
 * @param title content of a label placed as text of the radio button
 * @param suffix content of a label placed after the spinner
 * @param governor the governor that is loaded in the color picker widget when the button is selected
 * @param defaultEnabled true if the radio button is enabled by default, false otherwise
 * @param min min int value for the spinner
 * @param max max int value for the spinner
 * @return the spinner created
 */
private Spinner createRadio(Composite parent, String title, String suffix, IWidgetGovernor governor, boolean defaultEnabled, int min, int max){
	final Button radio = new Button(parent, SWT.RADIO);
	radioList.add(radio);
	radio.setText(title);
	radio.setData(governor);
	radio.setSelection(defaultEnabled);
	radio.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (radio.getSelection()){
				disableAllRadioExceptOne(radio);
				colorsSelector.setGovernor((IWidgetGovernor)radio.getData());
			}
		}
	
	});
	Spinner actualText = new Spinner(parent, SWT.BORDER);
	actualText.setMinimum(min);
	actualText.setMaximum(max);
	actualText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	if (suffix != null) new Label(parent, SWT.NONE).setText(suffix);
	else new Label(parent, SWT.NONE);
	actualText.addModifyListener(valueModifedListener);
	return actualText;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:42,代码来源:AdvancedColorWidget.java


注:本文中的org.eclipse.swt.widgets.Spinner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。