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

The following examples show how to use org.eclipse.swt.widgets.Slider#setLayoutData() . 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: 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 2
Source File: ChartSlider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void placeComponents( int style )
{
	GridLayout gl = new GridLayout( 1, false );
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginLeft = 0;
	gl.marginRight = 0;
	gl.marginTop = 0;
	gl.marginWidth = 0;
	this.setLayout( gl );
	
	slider = new Slider( this, style );
	GridData gd = new GridData( GridData.FILL_BOTH );
	slider.setLayoutData( gd );
}
 
Example 3
Source File: FontAwesomeSnippet3.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setText("FontAwesome Snippet");
	shell.setSize(1000, 600);
	shell.setLayout(new GridLayout(2, false));

	fScrolledComposite = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	fScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
	fScrolledComposite.setAlwaysShowScrollBars(false);
	fScrolledComposite.setExpandHorizontal(true);
	fScrolledComposite.setExpandVertical(true);

	Composite composite = new Composite(fScrolledComposite, SWT.NONE);
	fScrolledComposite.setContent(composite);

	RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
	rowLayout.marginTop = 5;
	rowLayout.marginRight = 5;
	rowLayout.marginLeft = 5;
	rowLayout.marginBottom = 5;
	rowLayout.pack = false;
	composite.setLayout(rowLayout);
	buildComposite(composite);
	calcMinsize(composite);
	shell.layout(true, true);

	fFontLabel = new Label(shell, SWT.NONE);
	fFontLabel.setText("Font size (22)");


	fSlider = new Slider(shell, SWT.NONE);
	fSlider.addListener(SWT.MouseUp, e -> {
		shell.setRedraw(false);
		Arrays.asList(composite.getChildren()).forEach(c -> c.dispose());
		fFontSize = fSlider.getSelection();
		buildComposite(composite);
		fFontLabel.setText("Font size (" + fFontSize + ")");
		shell.setRedraw(true);

		shell.layout(true, true);
		calcMinsize(composite);
	});
	fSlider.setPageIncrement(1);
	fSlider.setMaximum(150);
	fSlider.setMinimum(4);
	fSlider.setSelection(22);
	fSlider.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();

}