FileDocCategorySizeDatePackage
SliderExample.javaAPI DocExample1197Sun Oct 31 09:37:18 GMT 2004None

SliderExample

public class SliderExample extends Object

Fields Summary
Display
d
Shell
s
Constructors Summary
SliderExample()

         d = new Display();
         s = new Shell(d);
        s.setSize(250,250);
        s.setImage(new Image(d, "c:\\icons\\JavaCup.ico"));
        s.setText("A Slider Example");
        final Slider slide = new Slider(s, SWT.HORIZONTAL);
        slide.setBounds(115,50, 25, 15);
        slide.setMinimum(0);
        slide.setMaximum(100);
        slide.setIncrement(1);

        final Text t = new Text(s, SWT.BORDER);
        t.setBounds(115, 25, 25, 25);
        t.setText("0");
        
        slide.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                t.setText(new Integer(slide.getSelection()).toString());
            }
        });
        
        s.open();
        while(!s.isDisposed()){
            if(!d.readAndDispatch())
                d.sleep();
        }
        d.dispose();
    
Methods Summary