Home Tutorials Swt SWT Spinner



SWT Spinner
Posted on: October 3, 2008 at 12:00 AM
In SWT, the class Spinner of package org.eclipse.swt.widgets is used. The method setMinimum() sets the minimum value and the method setMaximum() sets the maximum value.

SWT Spinner

     

This section illustrates you how to create a spinner in SWT.

In SWT, the class Spinner of package org.eclipse.swt.widgets is used. The method setMinimum() sets the minimum value and the method setMaximum() sets the maximum value. The method setSize() of class Spinner sets the size of spinner. The method setIncrement() the value and the method setPageIncrement() sets the page increment.

Here is the code of SpinnerExample.java

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;

public class SpinnerExample {

  public static void main(String[] args) {
  Display display = new Display();
  Shell shell = new Shell(display);
  shell.setText("Spinner");

  Spinner spin = new Spinner(shell, 0);
  spin.setMinimum(0);
  spin.setMaximum(500);
  spin.setSelection(150);
  spin.setIncrement(1);
  spin.setPageIncrement(200);
  spin.setSize(150,40);

  shell.pack();
  shell.open();
  shell.setSize(17070);
  while (!shell.isDisposed()) {
  if (!display.readAndDispatch())
  display.sleep();
  }
  display.dispose();
  }
} 

Output will be displayed as

Download Source Code

     

Related Tags for SWT Spinner:
ceclipseclassswtsizemethodsedgetippagewidgetsvaluesetswidgetcliidpackagesetmaxmaximuminiincrementeaxliuseiminasmntminimumpsspinnerminmininnerpackclspiemagepimeacksspclippacpinkincisncrgetsandwidwtvazxissthspinswalueclorgmindo


More Tutorials from this section

Ask Questions?    Discuss: SWT Spinner  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.