Demonstrates Sliders : Slider « SWT JFace Eclipse « Java






Demonstrates Sliders

Demonstrates Sliders

//Send questions, comments, bug reports, etc. to the authors:

//Rob Warner (rwarner@interspatial.com)
//Robert Harris (rbrt_harris@yahoo.com)

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

/**
 * This class demonstrates Sliders
 */
public class SliderExample {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout(1, false));

    // Create a horizontal slider, accepting the defaults
    new Slider(shell, SWT.HORIZONTAL);
    
    // Create a vertical slider and set its properties
    Slider slider = new Slider(shell, SWT.VERTICAL);
    slider.setMinimum(0);
    slider.setMaximum(100);
    slider.setIncrement(5);
    slider.setPageIncrement(20);
    slider.setSelection(75);
    
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}

           
       








Related examples in the same category

1.Sample SliderSample Slider
2.Slider Example Slider Example
3.SWT SlidersSWT Sliders
4.SWT Slider: print scroll event detailsSWT Slider: print scroll event details