當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。