Java Code Examples for org.eclipse.swt.widgets.Slider#addSelectionListener()

The following examples show how to use org.eclipse.swt.widgets.Slider#addSelectionListener() . 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: InternalCompositeTable.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialize the sliderHolder and slider. The SliderHolder is a Composite
 * that is responsible for showing and hiding the vertical slider upon
 * request.
 */
private void createVSliderHolder() {
	GridData gd = getVSliderGridData();
	vSliderHolder = new Composite(this, SWT.NULL);
	vSlider = new Slider(vSliderHolder, SWT.VERTICAL);
	vSlider.addSelectionListener(sliderSelectionListener);
	vSliderHolder.setLayout(new FillLayout());
	vSliderHolder.setLayoutData(gd);
	vSliderHolder.setTabList(new Control[] {});
}
 
Example 2
Source File: InternalCompositeTable.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialize the sliderHolder and slider. The SliderHolder is a Composite
 * that is responsible for showing and hiding the vertical slider upon
 * request.
 */
private void createHSliderHolder() {
	GridData gd = getHSliderGridData();
	hSliderHolder = new Composite(this, SWT.NULL);
	hSlider = new Slider(hSliderHolder, SWT.HORIZONTAL);
	hSlider.setMinimum(0);
	hSlider.setIncrement(20);
	hSlider.addSelectionListener(sliderSelectionListener);
	hSliderHolder.setLayout(new FillLayout());
	hSliderHolder.setLayoutData(gd);
	hSliderHolder.setTabList(new Control[] {});
	hSlider.addSelectionListener(hSliderSelectionListener);
}
 
Example 3
Source File: TmfRawEventViewer.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void createSlider(int style) {
    fSlider = new Slider(this, SWT.VERTICAL);
    fSlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
    fSlider.setValues(0, 0, SLIDER_MAX, SLIDER_MAX, 1, 1);
    fSlider.addSelectionListener(this);
    fSlider.addMouseListener(this);
    if ((style & SWT.V_SCROLL) == 0) {
        fSlider.setVisible(false);
    }
}
 
Example 4
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);		
	
}