Java Code Examples for org.eclipse.swt.widgets.Spinner#setMinimum()

The following examples show how to use org.eclipse.swt.widgets.Spinner#setMinimum() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createDecoratorsGroup(Composite parent) {
	Group dataGroup = createEmptyGroup(parent, "Decorators");
	dataGroup.setLayout(new RowLayout());

	sDecoratorNumber = new Spinner(dataGroup, SWT.NONE);
	sDecoratorNumber.setMinimum(1);
	sDecoratorNumber.setMaximum(5);
	sDecoratorNumber.setIncrement(1);
	sDecoratorNumber.setSelection(1);
	sDecoratorNumber.addListener(SWT.Selection, contentParamSelectionListener);

	bDecoratorLeft = createButton(dataGroup, SWT.CHECK, "Top Left", false, false);
	bDecoratorLeft.addListener(SWT.Selection, contentParamSelectionListener);
	bDecoratorUp = createButton(dataGroup, SWT.CHECK, "Top Right", false, false);
	bDecoratorUp.addListener(SWT.Selection, contentParamSelectionListener);
	bDecoratorRight = createButton(dataGroup, SWT.CHECK, "Bottom Right", false, false);
	bDecoratorRight.addListener(SWT.Selection, contentParamSelectionListener);
	bDecoratorDown = createButton(dataGroup, SWT.CHECK, "Bottom Left", false, false);
	bDecoratorDown.addListener(SWT.Selection, contentParamSelectionListener);
}
 
Example 2
Source File: GalleryExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createItemParametersGroup(Composite parent) {
	Group dataGroup = createEmptyGroup(parent, "Item parameters");
	dataGroup.setLayout(new RowLayout());

	cItemRenderer = new Combo(dataGroup, SWT.READ_ONLY);
	cItemRenderer.setItems(new String[] { "Icon", "List" });
	cItemRenderer.setText("Icon");
	cItemRenderer.addListener(SWT.Selection, itemRendererParamSelectionListener);

	bItemDropShadow = createButton(dataGroup, SWT.CHECK, "Drop shadow", false, true);

	sItemDropShadowSize = new Spinner(dataGroup, SWT.NONE);
	sItemDropShadowSize.setMinimum(0);
	sItemDropShadowSize.setMaximum(20);
	sItemDropShadowSize.setIncrement(1);
	sItemDropShadowSize.setSelection(5);
	sItemDropShadowSize.addListener(SWT.Selection, itemRendererParamSelectionListener);

	bItemLabel = createButton(dataGroup, SWT.CHECK, "Display labels", false, true);
}
 
Example 3
Source File: GalleryExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createAnimationGroup(Composite parent) {
	Group animationGroup = createEmptyGroup(parent, "Animation");
	animationGroup.setLayout(new RowLayout());

	bAnimation = createButton(animationGroup, SWT.CHECK, "Animations", false, false);
	bAnimation.addListener(SWT.Selection, groupParamSelectionListener);

	cAnimationMovement = new Combo(animationGroup, SWT.READ_ONLY);
	cAnimationMovement.setItems(new String[] { "ExpoOut", "BounceOut", "ElasticOut", "LinearInOut" });
	cAnimationMovement.setText("ExpoOut");
	cAnimationMovement.addListener(SWT.Selection, groupParamSelectionListener);

	sAnimationDuration = new Spinner(animationGroup, SWT.NONE);
	sAnimationDuration.setMinimum(250);
	sAnimationDuration.setMaximum(5000);
	sAnimationDuration.setIncrement(100);
	sAnimationDuration.setSelection(500);
	sAnimationDuration.addListener(SWT.Selection, groupParamSelectionListener);
}
 
Example 4
Source File: SankeySelectionDialog.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createCutoffSpinner(FormToolkit tk, Composite comp) {
	tk.createLabel(comp, M.DontShowSmallerThen);
	Composite inner = tk.createComposite(comp);
	UI.gridLayout(inner, 2, 10, 0);
	Spinner spinner = new Spinner(inner, SWT.BORDER);
	spinner.setIncrement(100);
	spinner.setMinimum(0);
	spinner.setMaximum(100000);
	spinner.setDigits(3);
	spinner.setSelection((int) (cutoff * 100000));
	spinner.addModifyListener(e -> {
		cutoff = spinner.getSelection() / 100000d;
	});
	tk.adapt(spinner);
	tk.createLabel(inner, "%");
}
 
Example 5
Source File: PWSpinner.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite)
 */
@Override
public Control build(final Composite parent) {
	buildLabel(parent, GridData.CENTER);
	final Spinner spinner = new Spinner(parent, SWT.HORIZONTAL | SWT.BORDER);
	addControl(spinner);
	spinner.setMinimum(min);
	spinner.setMaximum(max);
	final Integer originalValue = (Integer) PreferenceWindow.getInstance().getValueFor(getPropertyKey());
	spinner.setSelection(originalValue.intValue());

	spinner.addListener(SWT.Modify, event -> {
		PreferenceWindow.getInstance().setValue(getPropertyKey(), Integer.valueOf(spinner.getSelection()));
	});

	return spinner;
}
 
Example 6
Source File: AttachMainTab.java    From aCute with Eclipse Public License 2.0 6 votes vote down vote up
@Override public void createControl(Composite parent) {
	Composite res = new Composite(parent, SWT.NONE);
	res.setLayout(new GridLayout(3, false));
	Label pidLabel = new Label(res, SWT.NONE);
	pidLabel.setText(Messages.AttachMainTab_processId);
	// As pid is volatile, additionally to PID, we should store the
	// CLI param of selected PID to easily discover other PID started
	// with same params.
	pidText = new Spinner(res, SWT.BORDER);
	pidText.setMinimum(0);
	pidText.setMaximum(Integer.MAX_VALUE);
	pidText.setLayoutData(new GridData(120, SWT.DEFAULT));
	pidText.addModifyListener(e -> {
		setDirty(true);
		updateLaunchConfigurationDialog();
	});
	// with Java 9, add a Search button showing a "ProcessSelectionDialog"
	// filtering process using dotnet as command.
	setControl(res);
}
 
Example 7
Source File: SpinnerField.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public SpinnerField(Composite parent, int displayBits, String displayName, int min, int max){
	super(parent, displayBits, displayName);
	final Spinner spinner = new Spinner(this, SWT.NONE);
	spinner.setMaximum(max);
	spinner.setMinimum(min);
	spinner.addSelectionListener(new SelectionAdapter() {
		
		@Override
		public void widgetSelected(SelectionEvent e){
			int v = spinner.getSelection();
			textContents = Integer.toString(v);
			fireChangedEvent();
		}
		
	});
	setControl(spinner);
	
}
 
Example 8
Source File: SeriesSheetImpl.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void initZOrderUI( Composite parent )
{
	spnZOrder = new Spinner( parent, SWT.BORDER );
	{
		GridData gd = new GridData( );
		gd.horizontalAlignment = SWT.CENTER;
		spnZOrder.setLayoutData( gd );
		spnZOrder.setMinimum( 0 );
		spnZOrder.setMaximum( 10 );
		if ( getChart( ) instanceof ChartWithAxes
				&& !( getContext( ).getChartType( ) instanceof BubbleChart )
				&& getChart( ).getDimension( ) == ChartDimension.TWO_DIMENSIONAL_LITERAL )
		{
			// Bubble chart has special z order
			spnZOrder.setSelection( seriesDefn.getZOrder( ) );
			spnZOrder.addSelectionListener( this );
		}
		else
		{
			spnZOrder.setEnabled( false );
		}
		ChartUIUtil.addSpinnerScreenReaderAccessbility( spnZOrder,
				Messages.getString( "SeriesSheetImpl.Label.ZOrder" ) ); //$NON-NLS-1$
	}
}
 
Example 9
Source File: SWTFactory.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param parent
 * @param min
 * @param max
 * @param hspan
 * @param style
 * @return
 */
public static Spinner createSpinner(Composite parent, int min, int max, int hspan, int style)
{
	Spinner spinner = new Spinner(parent, SWT.BORDER | style);
	spinner.setMinimum(min);
	spinner.setMaximum(max);

	GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false, hspan, 1);
	PixelConverter pc = new PixelConverter(spinner);
	// See http://jira.appcelerator.org/browse/APSTUD-3215
	// We need to add some extra spacing to the MacOSX spinner in order to adjust the size to the way Mac draws
	// spinners.
	int extraWidth = Platform.OS_MACOSX.equals(Platform.getOS()) ? 25 : 0;
	gd.widthHint = pc.convertWidthInCharsToPixels(2) + extraWidth;
	spinner.setLayoutData(gd);
	return spinner;
}
 
Example 10
Source File: PageSettingDialog.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void setMarginSpinner(Spinner spinner) {
	spinner.setDigits(1);
	spinner.setIncrement(5);
	spinner.setMinimum(0);
	spinner.setMaximum(1000);
	spinner.setSelection(20);
}
 
Example 11
Source File: NumberInput.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create an empty number input with a default increment of 5, a minimum of 5 and a maximum of
 * 1440 (which happens to be the number of minutes in a day)
 * 
 * @param parent
 * @param label
 *            the label to display on top of the input field
 */
public NumberInput(Composite parent, String label){
	super(parent, SWT.NONE);
	setLayout(new GridLayout());
	new Label(this, SWT.NONE).setText(label);
	inp = new Spinner(this, SWT.NONE);
	inp.setMinimum(5);
	inp.setMaximum(1440);
	inp.setIncrement(5);
}
 
Example 12
Source File: PageSettingDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void setMarginSpinner(Spinner spinner) {
    spinner.setDigits(1);
    spinner.setIncrement(5);
    spinner.setMinimum(0);
    spinner.setMaximum(1000);
    spinner.setSelection(20);
}
 
Example 13
Source File: CameraDirectionGroup.java    From depan with Apache License 2.0 5 votes vote down vote up
private Spinner setupDirection(Composite parent) {
  Spinner result = new Spinner(parent, SWT.NONE);
  result.setMinimum(-180);
  result.setMaximum(180);
  result.setIncrement(1);
  result.setPageIncrement(10);
  return result;
}
 
Example 14
Source File: PageSettingDialog.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void setMarginSpinner(final Spinner spinner) {
    spinner.setDigits(1);
    spinner.setIncrement(5);
    spinner.setMinimum(0);
    spinner.setMaximum(1000);
    spinner.setSelection(20);
}
 
Example 15
Source File: Snippet7.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private Spinner createPageCountSpinner(Composite parent,
		Listener selectionListener) {
	Spinner spinner = new Spinner(parent, SWT.BORDER);
	spinner.setMinimum(1);
	spinner.setMaximum(99);
	spinner.addListener(SWT.Selection, selectionListener);
	return spinner;
}
 
Example 16
Source File: Snippet8.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private Spinner createPageCountSpinner(Composite parent,
		Listener selectionListener) {
	Spinner spinner = new Spinner(parent, SWT.BORDER);
	spinner.setMinimum(1);
	spinner.setMaximum(99);
	spinner.addListener(SWT.Selection, selectionListener);
	return spinner;
}
 
Example 17
Source File: WizardUtils.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
public static Spinner createSpinner(Composite parent, int min, int max) {
    Spinner spinner = new Spinner(parent, SWT.BORDER);
    spinner.setMinimum(min);
    spinner.setMaximum(max);
    return spinner;        
}
 
Example 18
Source File: CompositeTableRow.java    From dawnsci with Eclipse Public License 1.0 4 votes vote down vote up
public CompositeTableRow(CompositeEntry entry,
					     Table container,
						 CompositingControl control,
						 boolean disableOp) {
	
	this.name = entry.getName();
	TableItem newItem = new TableItem(container,SWT.DOUBLE_BUFFERED);
	TableEditor editor0 = new TableEditor(container);
	editor0.horizontalAlignment = SWT.CENTER;
	editor0.grabHorizontal = true;
	chkActive = new Button(container,SWT.CHECK);
	chkActive.setSelection(true);
	chkActive.addSelectionListener(control);
	editor0.setEditor(chkActive,newItem,0);
	
	TableEditor editor = new TableEditor(container);
	editor.horizontalAlignment = SWT.CENTER;
	editor.grabHorizontal = true;
	panel = new Composite(container, SWT.NONE);
	panel.setLayout(new GridLayout(2,true));
	slider = new Slider(panel,SWT.HORIZONTAL|SWT.NO_TRIM);
	slider.setValues((int)(entry.getWeight()*100), 0, 104, 5, 1, 5);
	slider.addSelectionListener(this);
	slider.addSelectionListener(control);
	spinner = new Spinner(panel,SWT.DOUBLE_BUFFERED);
	spinner.setMinimum(0);
	spinner.setMaximum(100);
	spinner.setSelection((int)(entry.getWeight()*100));
	spinner.addSelectionListener(control);
	spinner.addSelectionListener(this);
	panel.pack();
	editor.setEditor(panel,newItem,2);
	newItem.setText(1,name);
	TableEditor editor2 = new TableEditor(container);
	editor2.horizontalAlignment = SWT.CENTER;
	editor2.grabHorizontal = true;
	editor2.grabVertical = true;
	op = new Combo(container,SWT.NONE);
	op.add("ADD");
	op.add("SUBTRACT");
	op.add("MULTIPLY");
	op.add("DIVIDE");
	op.add("MINIMUM");
	op.add("MAXIMUM");
	op.select(convertOperationToInt(entry.getOperation()));
	op.pack();
	op.addSelectionListener(control);
	op.setEnabled(!disableOp);
	editor2.setEditor(op,newItem,3);
	TableEditor editor3 = new TableEditor(container);
	editor3.horizontalAlignment = SWT.CENTER;
	editor3.grabHorizontal = true;
	editor3.grabVertical = true;
	chkRed = new Button(container,SWT.CHECK);
	chkRed.setSelection(true);
	chkRed.pack();
	chkRed.addSelectionListener(control);
	editor3.setEditor(chkRed,newItem,4);
	TableEditor editor4 = new TableEditor(container);
	editor4.horizontalAlignment = SWT.CENTER;
	editor4.grabHorizontal = true;
	editor4.grabVertical = true;
	chkGreen = new Button(container,SWT.CHECK);
	chkGreen.pack();
	chkGreen.setSelection(true);
	chkGreen.addSelectionListener(control);
	editor4.setEditor(chkGreen,newItem,5);
	TableEditor editor5 = new TableEditor(container);
	editor5.horizontalAlignment = SWT.CENTER;
	editor5.grabHorizontal = true;
	editor5.grabVertical = true;
	chkBlue = new Button(container,SWT.CHECK);
	chkBlue.pack();
	chkBlue.setSelection(true);
	chkBlue.addSelectionListener(control);
	editor5.setEditor(chkBlue,newItem,6);		
	
}
 
Example 19
Source File: IndentGuidePreferencePage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, true));

    enabled = new Button(composite, SWT.CHECK);
    enabled.setText(Messages.IndentGuidePreferencePage_EnableIndentGuide);
    enabled.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            enableControls(enabled.getSelection());
        }
    });

    Group group = new Group(composite, SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    group.setLayout(new GridLayout(1, true));
    group.setText(Messages.IndentGuidePreferencePage_LineAttributes);
    attributes = new Composite(group, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    gridData.horizontalIndent = 5;
    attributes.setLayoutData(gridData);
    attributes.setLayout(new GridLayout(2, false));

    new Label(attributes, SWT.NONE)
            .setText(Messages.IndentGuidePreferencePage_Alpha_0_255 + ':');
    lineAlpha = new Spinner(attributes, SWT.BORDER);
    lineAlpha.setMinimum(0);
    lineAlpha.setMaximum(255);
    new Label(attributes, SWT.NONE)
            .setText(Messages.IndentGuidePreferencePage_Style + ':');
    lineStyle = new Combo(attributes, SWT.READ_ONLY);
    lineStyle.setItems(styles);
    new Label(attributes, SWT.NONE)
            .setText(Messages.IndentGuidePreferencePage_Width_1_8 + ':');
    lineWidth = new Spinner(attributes, SWT.BORDER);
    lineWidth.setMinimum(1);
    lineWidth.setMaximum(8);
    new Label(attributes, SWT.NONE)
            .setText(Messages.IndentGuidePreferencePage_Shift_1_8 + ':');
    lineShift = new Spinner(attributes, SWT.BORDER);
    lineShift.setMinimum(0);
    lineShift.setMaximum(8);
    colorFieldEditor = new ColorFieldEditor(PreferenceConstants.LINE_COLOR,
            Messages.IndentGuidePreferencePage_Color + ':', attributes);
    colorFieldEditor.setPreferenceStore(getPreferenceStore());

    loadPreferences();
    return composite;
}
 
Example 20
Source File: HorizontalSpinnerSnippet.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private static void createSpinnerGroup(final Shell shell) {
	final Group group = new Group(shell, SWT.NONE);
	group.setLayout(new GridLayout(1, false));

	final Label lbl1 = new Label(group, SWT.NONE);
	lbl1.setText("Simple vertical spinner :");
	final Spinner spinner1 = new Spinner(group, SWT.BORDER);
	spinner1.setMinimum(0);
	spinner1.setMaximum(1000);
	spinner1.setSelection(500);
	spinner1.setIncrement(1);
	spinner1.setPageIncrement(100);

	final Label lbl2 = new Label(group, SWT.NONE);
	lbl2.setText("Floating point values in Spinner :");
	final Spinner spinner2 = new Spinner(group, SWT.NONE);
	// allow 3 decimal places
	spinner2.setDigits(3);
	// set the minimum value to 0.001
	spinner2.setMinimum(1);
	// set the maximum value to 20
	spinner2.setMaximum(20000);
	// set the increment value to 0.010
	spinner2.setIncrement(10);
	// set the seletion to 3.456
	spinner2.setSelection(3456);
	spinner2.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(final SelectionEvent e) {
			final int selection = spinner2.getSelection();
			final int digits = spinner2.getDigits();
			System.out.println("Selection is " + selection / Math.pow(10, digits));
		}
	});

	final Label lbl3 = new Label(group, SWT.NONE);
	lbl3.setText("Validate input in a spinner widget :");
	final Spinner spinner3 = new Spinner(group, SWT.BORDER);
	spinner3.setValues(0, -100, 100, 0, 1, 10);
	spinner3.setLayoutData(new GridData(200, SWT.DEFAULT));
	final ToolTip toolTip = new ToolTip(shell, SWT.BALLOON | SWT.ICON_WARNING);
	spinner3.addModifyListener(e -> {
		final String string = spinner3.getText();
		String message = null;
		try {
			final int value = Integer.parseInt(string);
			final int maximum = spinner3.getMaximum();
			final int minimum = spinner3.getMinimum();
			if (value > maximum) {
				message = "Current input is greater than the maximum limit (" + maximum + ")";
			} else if (value < minimum) {
				message = "Current input is less than the minimum limit (" + minimum + ")";
			}
		} catch (final Exception ex) {
			message = "Current input is not numeric";
		}
		if (message != null) {
			spinner3.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_RED));
			final Rectangle rect = spinner3.getBounds();
			final GC gc = new GC(spinner3);
			final Point pt = gc.textExtent(string);
			gc.dispose();
			toolTip.setLocation(shell.getDisplay().map(shell, null, rect.x + pt.x, rect.y + rect.height));
			toolTip.setMessage(message);
			toolTip.setVisible(true);
		} else {
			toolTip.setVisible(false);
			spinner3.setForeground(null);
		}
	});

}