org.eclipse.swt.widgets.Spinner.setValues()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.eclipse.swt.widgets.Spinner.setValues()方法的一些代码示例,展示了Spinner.setValues()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.setValues()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Spinner
类名称:Spinner
方法名:setValues

Spinner.setValues介绍

[英]Sets the receiver's selection, minimum value, maximum value, digits, increment and page increment all at once.

Note: This is similar to setting the values individually using the appropriate methods, but may be implemented in a more efficient fashion on some platforms.
[中]同时设置接收器的选择、最小值、最大值、数字、增量和页面增量。
注意:这类似于使用适当的方法单独设置值,但在某些平台上可能会以更高效的方式实现。

代码示例

代码示例来源:origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public Control createControl(Composite parent) {
  Composite composite = new Composite(parent, SWT.NONE);
  GridLayout gridLayout = new GridLayout(2, false);
  gridLayout.marginHeight = 0;
  gridLayout.marginWidth = 0;
  composite.setLayout(gridLayout);
  spinner = new Spinner(composite, SWT.BORDER | SWT.RIGHT);
  spinner.setValues((int) (property.getValue().floatValue() * 100), 0, 100, 0, 1, 5);
  spinner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
  spinner.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      int selection = spinner.getSelection();
      Float value = Float.valueOf(selection / 100f);
      sendPropertyUpdateEvent(value);
    }
  });
  Label percentage = new Label(composite, SWT.NONE);
  percentage.setText("%");
  percentage.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
  return composite;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.trace

maximumFileCountSpinner.setValues(10, 10, 100, 0, 5, 10);
maximumFileCountSpinner.addListener(SWT.Verify,
    e -> TracingPreferencePage.this.verifyIntInput(e, Messages.tracingFileInvalidMaxCount));
maximumFileSizeSpinner.setValues(100, 100, 10000, 0, 100, 1000);
maximumFileSizeSpinner.addListener(SWT.Verify,
    e -> TracingPreferencePage.this.verifyIntInput(e, Messages.tracingFileInvalidMaxSize));

代码示例来源:origin: org.eclipse.ui/trace

maximumFileCountSpinner.setValues(10, 10, 100, 0, 5, 10);
maximumFileCountSpinner.addListener(SWT.Verify, new Listener() {
maximumFileSizeSpinner.setValues(100, 100, 10000, 0, 100, 1000);
maximumFileSizeSpinner.addListener(SWT.Verify, new Listener() {

相关文章