org.eclipse.swt.widgets.Scale Java Examples

The following examples show how to use org.eclipse.swt.widgets.Scale. 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: PWScale.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite)
 */
@Override
public Control build(final Composite parent) {
	buildLabel(parent, GridData.CENTER);
	final Scale scale = new Scale(parent, SWT.HORIZONTAL);
	addControl(scale);
	scale.setIncrement(this.increment);
	scale.setMinimum(this.min);
	scale.setMaximum(this.max);
	final Integer originalValue = (Integer) PreferenceWindow.getInstance().getValueFor(getPropertyKey());
	scale.setSelection(originalValue.intValue());

	scale.addListener(SWT.Modify, new Listener() {
		@Override
		public void handleEvent(final Event event) {
			PreferenceWindow.getInstance().setValue(getPropertyKey(), Integer.valueOf(scale.getSelection()));
		}
	});

	return scale;
}
 
Example #2
Source File: FindReplaceDialog.java    From pmTrans with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void renderTransparency(final Shell shell) {
	Group group = new Group(shell, SWT.NONE);
	group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1));
	group.setLayout(new GridLayout(1, false));
	group.setText("Transparency");
	final Scale transparencySlider = new Scale(group, SWT.HORIZONTAL);
	transparencySlider.setMinimum(20);
	transparencySlider.setMaximum(100);
	transparencySlider.setPageIncrement(90);
	transparencySlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	transparencySlider.setSelection(100);
	transparencySlider.addListener(SWT.Selection, new Listener() {

		@Override
		public void handleEvent(Event event) {
			shell.setAlpha(255 * transparencySlider.getSelection() / 100);
		}
	});
}
 
Example #3
Source File: EventVsFrpTwoWay.java    From gradle-and-eclipse-rcp with Apache License 2.0 6 votes vote down vote up
public IntValue(Composite parent, int initialValue) {
	inputField = new Text(parent, SWT.BORDER | SWT.SINGLE);
	outputField = new Label(parent, SWT.NONE);
	scale = new Scale(parent, SWT.HORIZONTAL);

	inputField.setText(Integer.toString(initialValue));
	outputField.setText(msgForValue(initialValue));
	scale.setMinimum(0);
	scale.setMaximum(100);
	scale.setSelection(initialValue);

	Layouts.setGrid(parent);
	Layouts.setGridData(inputField).grabHorizontal();
	Layouts.setGridData(outputField).grabHorizontal();
	Layouts.setGridData(scale).grabHorizontal();
}
 
Example #4
Source File: ColorPickerTest.java    From gradle-and-eclipse-rcp with Apache License 2.0 6 votes vote down vote up
@Test
public void testControl() {
	InteractiveTest.testCoat("Should show the YCbCr plane at various values of Y", cmp -> {
		Layouts.setGrid(cmp);

		Scale scale = new Scale(cmp, SWT.HORIZONTAL);
		scale.setMinimum(0);
		scale.setMaximum(255);
		scale.setSelection(128);
		Layouts.setGridData(scale).grabHorizontal();

		ColorPicker colors = new ColorPicker(cmp);
		Layouts.setGridData(colors).grabAll();

		scale.addListener(SWT.Selection, e -> {
			colors.setY(scale.getSelection());
		});
	});
}
 
Example #5
Source File: NavigationPageScaleRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void createUI(Composite parent) {
	GridLayout layout = new GridLayout(1, false);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	this.setLayout(layout);

	pageScale = new Scale(parent, SWT.READ_ONLY);
	pageScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	pageScale.addSelectionListener(this);
}
 
Example #6
Source File: SankeyMiniViewAction.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createScale(Composite composite) {
	Scale scale = new Scale(composite, SWT.NONE);
	scale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	double[] values = new double[] { 0.25, 0.5, 0.75, 1.0, 1.5,
			2.0, 2.5, 3.0, 4.0, 5.0, 10.0, 20.0 };
	scale.setIncrement(9);
	scale.setMinimum(0);
	scale.setMaximum(99);
	Controls.onSelect(scale, (e) -> {
		ZoomManager zoom = part.getZoomManager();
		zoom.setZoom(values[scale.getSelection() / 9]);
	});
	scale.setSelection(33);
}
 
Example #7
Source File: ReportConfigurationTab.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void createRankGroup(Composite parent) {
    Composite prioGroup = new Composite(parent, SWT.NONE);
    prioGroup.setLayout(new GridLayout(2, false));

    Label minRankLabel = new Label(prioGroup, SWT.NONE);
    minRankLabel.setText(getMessage("property.minRank") + System.getProperty("line.separator")
            + getMessage("property.minRank.line2"));
    minRankLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    minRankSlider = new Scale(prioGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    minRankSlider.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
    minRankSlider.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            int rank = minRankSlider.getSelection();
            getCurrentProps().getFilterSettings().setMinRank(rank);
            updateRankValueLabel();
        }
    });
    minRankSlider.setMinimum(BugRanker.VISIBLE_RANK_MIN);
    minRankSlider.setMaximum(BugRanker.VISIBLE_RANK_MAX);
    minRankSlider.setSelection(getCurrentProps().getFilterSettings().getMinRank());
    minRankSlider.setIncrement(1);
    minRankSlider.setPageIncrement(5);
    Label dummyLabel = new Label(prioGroup, SWT.NONE);
    dummyLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));

    rankValueLabel = new Label(prioGroup, SWT.NONE);
    rankValueLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
    updateRankValueLabel();
}
 
Example #8
Source File: SWTScaleKnob.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void showShell() {
	if( isShellDisposed() ){
		this.shell = new Shell(this.getControl().getShell(), SWT.NO_TRIM );
		this.shell.setVisible(false);
		this.shell.setLayout(getGridLayout());
		
		this.composite = new Composite(this.shell, SWT.BORDER);
		this.composite.setLayout(getGridLayout());
		this.composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		
		this.scale = new Scale(this.composite, SWT.VERTICAL );
		this.scale.setMaximum(this.maximum);
		this.scale.setMinimum(this.minimum);
		this.scale.setIncrement(this.increment);
		this.scale.setPageIncrement(this.increment * 3);
		this.scale.setLayoutData(getScaleLayoutData());
		this.setValueToScale();
		
		this.scale.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent event) {
				SWTScaleKnob.this.getValueFromScale();
				SWTScaleKnob.this.selectionListener.widgetSelected(event);
			}
		});
		
		this.shell.pack();
		this.moveShell();
		this.shell.setVisible(true);
	}
}
 
Example #9
Source File: PGroupSnippet1.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new GridLayout());

    PGroup group = new PGroup(shell, SWT.SMOOTH);
    group.setText("Example");
    
//  Optionally, change strategy and toggle
//  group.setStrategy(new FormGroupStrategy());
//  group.setToggleRenderer(new TwisteToggleRenderer());
    
    group.setLayout(new GridLayout());
    
    Label label = new Label(group,SWT.NONE);
    label.setText("Contents");
    Button button = new Button(group,SWT.PUSH);
    button.setText("Contents");
    Scale scale = new Scale(group,SWT.HORIZONTAL);
    
    
    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example #10
Source File: XkcdColorPicker.java    From gradle-and-eclipse-rcp with Apache License 2.0 5 votes vote down vote up
public XkcdColorPicker(Composite parent, RGB initRGB) {
	super(new Composite(parent, SWT.NONE));
	RGB initYCbCr = ColorPicker.toYCbCr(initRGB);

	// create a scale and bind it to an RxBox<Integer>
	RxBox<Integer> luminance = RxBox.of(initYCbCr.red);

	// colorpanel in the center
	ColorPicker cbcrPanel = new ColorPicker(wrapped);
	Rx.subscribe(luminance, cbcrPanel::setY);

	// controls at the right
	Composite rightCmp = new Composite(wrapped, SWT.NONE);

	// scale below
	Scale scale = new Scale(wrapped, SWT.HORIZONTAL);
	scale.setMinimum(0);
	scale.setMaximum(255);
	Rx.subscribe(luminance, scale::setSelection);
	scale.addListener(SWT.Selection, e -> {
		luminance.set(scale.getSelection());
	});

	Layouts.setGrid(wrapped).numColumns(2);
	Layouts.setGridData(cbcrPanel).grabAll();
	Layouts.setGridData(rightCmp).grabVertical().verticalSpan(2);
	Layouts.setGridData(scale).grabHorizontal();

	// populate the bottom
	Layouts.setGrid(rightCmp).margin(0);
	XkcdColors.Lookup xkcdLookup = new XkcdColors.Lookup(rightCmp);

	Group hoverGrp = new Group(rightCmp, SWT.SHADOW_ETCHED_IN);
	hoverGrp.setText("Hover");
	createGroup(hoverGrp, cbcrPanel.rxMouseMove(), xkcdLookup);

	Group clickGrp = new Group(rightCmp, SWT.SHADOW_ETCHED_IN);
	clickGrp.setText("Click");
	createGroup(clickGrp, cbcrPanel.rxMouseDown(), xkcdLookup);
}
 
Example #11
Source File: LegendPageBar.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public LegendPageBar(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(2, false));
	
	lblLegend = new Label(this, SWT.NONE);
	lblLegend.setText("Legend ");
	
	btnEnableLegend = new Button(this, SWT.CHECK);
	btnEnableLegend.setText("Enable Legend");
	
	Label lblBackgroundColor = new Label(this, SWT.NONE);
	GridData gd_lblBackgroundColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_lblBackgroundColor.widthHint = 150;
	lblBackgroundColor.setLayoutData(gd_lblBackgroundColor);
	lblBackgroundColor.setText("Background Color");
	
	labelColorShow = new Label(this, SWT.BORDER);
	GridData gd_labelColorShow = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_labelColorShow.widthHint = 100;
	labelColorShow.setLayoutData(gd_labelColorShow);
	labelColorShow.setText(" ");
	labelColorShow.setBackground(PageSupport.getColor(parent, 0));
	labelColorShow.addMouseListener(this);
	
	Label lblOutline = new Label(this, SWT.NONE);
	lblOutline.setText("Outline Style");
	
	comboOutline = new Combo(this, SWT.READ_ONLY);
	comboOutline.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboOutline.add("None");
	comboOutline.add("Dashed");
	comboOutline.add("Dash Dotted");
	comboOutline.add("Dotted");
	comboOutline.add("Solid");
	comboOutline.select(0);
	
	lblMaxPercent = new Label(this, SWT.NONE);
	lblMaxPercent.setText("Max. Percent");
	
	scale = new Scale(this, SWT.NONE);
	scale.setIncrement(2);
	GridData gd_scale = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_scale.widthHint = 309;
	scale.setLayoutData(gd_scale);
	scale.setPageIncrement(2);
	scale.setMaximum(50);
	scale.setSelection(10);
	scale.addSelectionListener(this);
	
	Label lblPosition = new Label(this, SWT.NONE);
	lblPosition.setText("Position");
	
	comboPosition = new Combo(this, SWT.READ_ONLY);
	comboPosition.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboPosition.add("Right");
	comboPosition.add("Left");
	comboPosition.add("Below");
	comboPosition.add("Top");
	comboPosition.select(0);		

	loadSettings();
}
 
Example #12
Source File: SpinnerWithScale.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public SpinnerWithScale(Spinner spinner, Scale scale, int diff) {
	this.spinner = spinner;
	this.scale = scale;
	this.diff = diff;
}
 
Example #13
Source File: Controls.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
public static void onSelect(Scale scale, Consumer<SelectionEvent> consumer) {
	scale.addSelectionListener(selectionListener(consumer));
}
 
Example #14
Source File: OpenMiniatureViewAction.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {
	FormToolkit toolkit = new FormToolkit(Display.getCurrent());
	ScrolledForm scrolledForm = toolkit.createScrolledForm(parent);
	Composite body = scrolledForm.getBody();
	body.setLayout(new FillLayout());
	toolkit.paintBordersFor(body);

	SashForm sashForm = new SashForm(body, SWT.VERTICAL);
	toolkit.adapt(sashForm, true, true);

	Section categorySection = toolkit
			.createSection(sashForm, ExpandableComposite.NO_TITLE
					| ExpandableComposite.EXPANDED);
	categorySection.setText("");
	Composite composite = toolkit.createComposite(categorySection,
			SWT.NONE);
	composite.setLayout(new GridLayout());
	categorySection.setClient(composite);
	toolkit.paintBordersFor(composite);
	final Scale scale = new Scale(composite, SWT.NONE);
	scale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	final double[] values = GraphConfig.ZOOM_LEVELS;
	final int increment = 100 / (values.length - 1);
	scale.setIncrement(increment);
	scale.setMinimum(0);
	scale.setMaximum(100);
	Controls.onSelect(scale, (e) -> {
		zoomManager.setZoom(values[scale.getSelection() / increment]);
	});
	scale.setSelection(increment * (values.length - 1) / 2);
	Canvas canvas = new Canvas(composite, SWT.BORDER);
	canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	lws = new LightweightSystem(canvas);
	thumbnail = new ScrollableThumbnail(port);
	thumbnail.setSource(figure);
	lws.setContents(thumbnail);
	disposeListener = new DisposeListener() {

		@Override
		public void widgetDisposed(final DisposeEvent e) {
			if (thumbnail != null) {
				thumbnail.deactivate();
				thumbnail = null;
			}
			if (control != null && !control.isDisposed())
				control.removeDisposeListener(disposeListener);
			close();
		}
	};
	control.addDisposeListener(disposeListener);
	return super.createContents(parent);
}
 
Example #15
Source File: TableHierarchicalExample.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the controls that compose the console test.
 * 
 */
protected void createControls(IHierarchicalJaretTableModel hierarchicalModel) {
    GridLayout gl = new GridLayout();
    gl.numColumns = 1;
    _shell.setLayout(gl);

    GridData gd = new GridData(GridData.FILL_BOTH);

    _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL);
    _jt.setLayoutData(gd);

    IHierarchicalJaretTableModel hmodel = hierarchicalModel;

    if (hierarchicalModel == null) {

        ITableNode root = new DummyTableNode("tn1", "tn1", "Root", "This the root node");
        ITableNode r1 = new DummyTableNode("tn11", "tn12", "1", "Child 1 of the root");
        ITableNode r2 = new DummyTableNode("tn12", "tn12", "2", "Child 2 of the root");
        ITableNode r3 = new DummyTableNode("tn13", "tn13", "3", "Child 3 of the root");
        root.addNode(r1);
        root.addNode(r2);
        root.addNode(r3);

        r1.addNode(new DummyTableNode("tn111", "tn111", "1", "A second level child"));
        r1.addNode(new DummyTableNode("tn112", "tn112", "2", "Another second level child"));

        ITableNode n1 = new DummyTableNode("tn131", "tn131", "1", "A second level child");
        r3.addNode(n1);
        ITableNode n2 = new DummyTableNode("tn132", "tn132", "2", "Another second level child");
        r3.addNode(n2);

        n1.addNode(new DummyTableNode("tn1311", "tn1311", "1", "A third level child"));
        n1.addNode(new DummyTableNode("tn1312", "tn1312", "2", "Another third level child"));

        DefaultHierarchicalTableModel dhmodel = new DefaultHierarchicalTableModel(root);
        hmodel = dhmodel;

        if (SUPPORT_DND) {
            // init the simple drag and drop handling
            initDND(_jt, _shell);
        }
    }

    _jt.setTableModel(hmodel);
    StdHierarchicalTableModel model = (StdHierarchicalTableModel) _jt.getTableModel();
    IColumn hcol = new HierarchyColumn();
    // create and setup hierarchy renderer
    final TableHierarchyRenderer hierarchyRenderer = new TableHierarchyRenderer();
    hierarchyRenderer.setLabelProvider(new LabelProvider());
    hierarchyRenderer.setDrawIcons(true);
    hierarchyRenderer.setDrawLabels(true);
    _jt.registerCellRenderer(hcol, hierarchyRenderer);
    model.addColumn(hcol);

    model.addColumn(new PropCol("b1", "column 1", "B1"));
    model.addColumn(new PropCol("t1", "column 2", "T1"));
    model.addColumn(new PropCol("t2", "column 3", "T2"));
    model.addColumn(new PropCol("t3", "column 4", "T3"));

    JaretTableActionFactory af = new JaretTableActionFactory();

    MenuManager mm = new MenuManager();
    mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS));
    _jt.setHeaderContextMenu(mm.createContextMenu(_jt));

    MenuManager rm = new MenuManager();
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT));
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS));
    _jt.setRowContextMenu(rm.createContextMenu(_jt));

    TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt);

    Label l = new Label(_shell, SWT.NONE);
    l.setText("Level width:");
    final Scale levelWidthScale = new Scale(_shell, SWT.HORIZONTAL);
    levelWidthScale.setMaximum(40);
    levelWidthScale.setMinimum(0);
    levelWidthScale.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent ev) {
            int val = levelWidthScale.getSelection();
            hierarchyRenderer.setLevelWidth(val);
            _jt.redraw();
        }
    });

}
 
Example #16
Source File: TableHierarchicalExample.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the controls that compose the console test.
 * 
 */
protected void createControls(IHierarchicalJaretTableModel hierarchicalModel) {
    GridLayout gl = new GridLayout();
    gl.numColumns = 1;
    _shell.setLayout(gl);

    GridData gd = new GridData(GridData.FILL_BOTH);

    _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL);
    _jt.setLayoutData(gd);

    IHierarchicalJaretTableModel hmodel = hierarchicalModel;

    if (hierarchicalModel == null) {

        ITableNode root = new DummyTableNode("tn1", "tn1", "Root", "This the root node");
        ITableNode r1 = new DummyTableNode("tn11", "tn12", "1", "Child 1 of the root");
        ITableNode r2 = new DummyTableNode("tn12", "tn12", "2", "Child 2 of the root");
        ITableNode r3 = new DummyTableNode("tn13", "tn13", "3", "Child 3 of the root");
        root.addNode(r1);
        root.addNode(r2);
        root.addNode(r3);

        r1.addNode(new DummyTableNode("tn111", "tn111", "1", "A second level child"));
        r1.addNode(new DummyTableNode("tn112", "tn112", "2", "Another second level child"));

        ITableNode n1 = new DummyTableNode("tn131", "tn131", "1", "A second level child");
        r3.addNode(n1);
        ITableNode n2 = new DummyTableNode("tn132", "tn132", "2", "Another second level child");
        r3.addNode(n2);

        n1.addNode(new DummyTableNode("tn1311", "tn1311", "1", "A third level child"));
        n1.addNode(new DummyTableNode("tn1312", "tn1312", "2", "Another third level child"));

        DefaultHierarchicalTableModel dhmodel = new DefaultHierarchicalTableModel(root);
        hmodel = dhmodel;

        if (SUPPORT_DND) {
            // init the simple drag and drop handling
            initDND(_jt, _shell);
        }
    }

    _jt.setTableModel(hmodel);
    StdHierarchicalTableModel model = (StdHierarchicalTableModel) _jt.getTableModel();
    IColumn hcol = new HierarchyColumn();
    // create and setup hierarchy renderer
    final TableHierarchyRenderer hierarchyRenderer = new TableHierarchyRenderer();
    hierarchyRenderer.setLabelProvider(new LabelProvider());
    hierarchyRenderer.setDrawIcons(true);
    hierarchyRenderer.setDrawLabels(true);
    _jt.registerCellRenderer(hcol, hierarchyRenderer);
    model.addColumn(hcol);

    model.addColumn(new PropCol("b1", "column 1", "B1"));
    model.addColumn(new PropCol("t1", "column 2", "T1"));
    model.addColumn(new PropCol("t2", "column 3", "T2"));
    model.addColumn(new PropCol("t3", "column 4", "T3"));

    JaretTableActionFactory af = new JaretTableActionFactory();

    MenuManager mm = new MenuManager();
    mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS));
    _jt.setHeaderContextMenu(mm.createContextMenu(_jt));

    MenuManager rm = new MenuManager();
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT));
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS));
    _jt.setRowContextMenu(rm.createContextMenu(_jt));

    TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt);

    Label l = new Label(_shell, SWT.NONE);
    l.setText("Level width:");
    final Scale levelWidthScale = new Scale(_shell, SWT.HORIZONTAL);
    levelWidthScale.setMaximum(40);
    levelWidthScale.setMinimum(0);
    levelWidthScale.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent ev) {
            int val = levelWidthScale.getSelection();
            hierarchyRenderer.setLevelWidth(val);
            _jt.redraw();
        }
    });

}
 
Example #17
Source File: LegendPagePie.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public LegendPagePie(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(2, false));
	
	lblLegend = new Label(this, SWT.NONE);
	lblLegend.setText("Legend");
	
	btnEnableLegend = new Button(this, SWT.CHECK);
	btnEnableLegend.setText("Enable Legend");
	
	Label lblBackgroundColor = new Label(this, SWT.NONE);
	GridData gd_lblBackgroundColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_lblBackgroundColor.widthHint = 150;
	lblBackgroundColor.setLayoutData(gd_lblBackgroundColor);
	lblBackgroundColor.setText("Background Color");
	
	labelColorShow = new Label(this, SWT.BORDER);
	GridData gd_labelColorShow = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_labelColorShow.widthHint = 100;
	labelColorShow.setLayoutData(gd_labelColorShow);
	labelColorShow.setText(" ");
	labelColorShow.setBackground(PageSupport.getColor(parent, 0));
	labelColorShow.addMouseListener(this);
	
	Label lblOutline = new Label(this, SWT.NONE);
	lblOutline.setText("Outline Style");
	
	comboOutline = new Combo(this, SWT.READ_ONLY);
	comboOutline.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboOutline.add("None");
	comboOutline.add("Dashed");
	comboOutline.add("Dash Dotted");
	comboOutline.add("Dotted");
	comboOutline.add("Solid");
	comboOutline.select(0);
	
	lblMaxPercent = new Label(this, SWT.NONE);
	lblMaxPercent.setText("Max. Percent");
	
	scale = new Scale(this, SWT.NONE);
	scale.setIncrement(2);
	GridData gd_scale = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_scale.widthHint = 309;
	scale.setLayoutData(gd_scale);
	scale.setPageIncrement(2);
	scale.setMaximum(50);
	scale.setSelection(10);
	scale.addSelectionListener(this);
	
	Label lblPosition = new Label(this, SWT.NONE);
	lblPosition.setText("Position");
	
	comboPosition = new Combo(this, SWT.READ_ONLY);
	comboPosition.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboPosition.add("Right");
	comboPosition.add("Left");
	comboPosition.add("Below");
	comboPosition.add("Top");
	comboPosition.select(0);		
	
	

	loadSettings();
}
 
Example #18
Source File: SpinnerWithScale.java    From erflute with Apache License 2.0 4 votes vote down vote up
public SpinnerWithScale(Spinner spinner, Scale scale, int diff) {
    this.spinner = spinner;
    this.scale = scale;
    this.diff = diff;
}
 
Example #19
Source File: SWTScale.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SWTScale(SWTContainer<? extends Composite> parent, int orientation) {
	super(new Scale(parent.getControl(), SWT.BORDER | orientation), parent);
	
	this.selectionListener = new SWTSelectionListenerManager(this);
}
 
Example #20
Source File: SpinnerWithScale.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
public SpinnerWithScale(final Spinner spinner, final Scale scale, final int diff) {
    this.spinner = spinner;
    this.scale = scale;
    this.diff = diff;
}
 
Example #21
Source File: PGroupSnippet2.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new GridLayout());

    //Set the shell background to something different
    shell.setBackground(display.getSystemColor(SWT.COLOR_RED));
    
    //Tell the shell to give its children the same background color or image
    shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
    
    //Optionally trying creating a patterned image for the shell background
//    final Image backImage = new Image(display,10,10);
//    GC gc = new GC(backImage);
//    gc.drawLine(0,0,9,9);
//    gc.dispose();
//    shell.addDisposeListener(new DisposeListener() {
//		public void widgetDisposed(DisposeEvent e) {
//			backImage.dispose();
//		}	
//	});
//    shell.setBackgroundImage(backImage);
    
    PGroup group = new PGroup(shell, SWT.SMOOTH);
    group.setText("Example");
    group.setLayout(new FillLayout());    
    group.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    Composite groupClient = new Composite(group,SWT.NONE);
    groupClient.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    groupClient.setLayout(new GridLayout());
    
    Label label = new Label(groupClient,SWT.NONE);
    label.setText("Contents");
    Button button = new Button(groupClient,SWT.PUSH);
    button.setText("Contents");
    Scale scale = new Scale(groupClient,SWT.HORIZONTAL);
    
    
    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}