Java Code Examples for org.eclipse.swt.widgets.Scale#setIncrement()
The following examples show how to use
org.eclipse.swt.widgets.Scale#setIncrement() .
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 |
/** * @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: ReportConfigurationTab.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
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 3
Source File: SankeyMiniViewAction.java From olca-app with Mozilla Public License 2.0 | 5 votes |
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 4
Source File: LegendPageBar.java From slr-toolkit with Eclipse Public License 1.0 | 4 votes |
/** * 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 5
Source File: LegendPagePie.java From slr-toolkit with Eclipse Public License 1.0 | 4 votes |
/** * 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 6
Source File: OpenMiniatureViewAction.java From olca-app with Mozilla Public License 2.0 | 4 votes |
@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); }