Create and initialize a spinner widget : Spinner « SWT « Java Tutorial






Create and initialize a spinner widget
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;

public class SpinnerCreateInit {

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Spinner spinner = new Spinner(shell, SWT.BORDER);
    spinner.setMinimum(0);
    spinner.setMaximum(1000);
    spinner.setSelection(500);
    spinner.setIncrement(1);
    spinner.setPageIncrement(100);
    spinner.pack();
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
}








17.28.Spinner
17.28.1.Create and initialize a spinner widgetCreate and initialize a spinner widget
17.28.2.Floating point values in SpinnerFloating point values in Spinner