本文整理汇总了Java中org.eclipse.swt.widgets.Scale.setSelection方法的典型用法代码示例。如果您正苦于以下问题:Java Scale.setSelection方法的具体用法?Java Scale.setSelection怎么用?Java Scale.setSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Scale
的用法示例。
在下文中一共展示了Scale.setSelection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderTransparency
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
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);
}
});
}
示例2: fillSynthGainScale
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
protected void fillSynthGainScale( Scale scale ){
double[] range = getSynth().getDoublePropertyRange( MidiSettings.SYNTH_GAIN );
if( range.length == 2 ){
int value = (int)Math.round( getDoubleValue( MidiSettings.SYNTH_GAIN ) * 10f );
int minimum = (int)Math.round( range[0] * 10 );
int maximum = (int)Math.round( range[1] * 10 );
if( minimum < maximum ){
scale.setMinimum( minimum );
scale.setMaximum( maximum );
scale.setIncrement(1);
scale.setPageIncrement(10);
if( value >= minimum && value <= maximum ){
scale.setSelection( value );
}
}
}
}
示例3: IntValue
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
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();
}
示例4: adjustScaleValueOnMouseScroll
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
public static void adjustScaleValueOnMouseScroll(final MouseEvent event) {
boolean isCtrlKey;
boolean isShiftKey;
if (IS_OSX) {
isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
isShiftKey = (event.stateMask & SWT.MOD3) > 0;
// isAltKey = (event.stateMask & SWT.MOD3) > 0;
} else {
isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
isShiftKey = (event.stateMask & SWT.MOD2) > 0;
// isAltKey = (event.stateMask & SWT.MOD3) > 0;
}
// accelerate with Ctrl + Shift key
int accelerator = isCtrlKey ? 10 : 1;
accelerator *= isShiftKey ? 5 : 1;
final Scale scale = (Scale) event.widget;
final int increment = scale.getIncrement();
final int oldValue = scale.getSelection();
final int valueDiff = ((event.count > 0 ? increment : -increment) * accelerator);
scale.setSelection(oldValue + valueDiff);
}
示例5: SliderImpl
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
public SliderImpl(final Object parentUiReference, final ISliderSetupSpi setup, final SwtImageRegistry imageRegistry) {
super(new Scale((Composite) parentUiReference, getStyle(setup)), imageRegistry);
this.orientation = setup.getOrientation();
final Scale scale = getUiReference();
scale.setMaximum(setup.getMaximum());
scale.setMinimum(setup.getMinimum());
scale.setSelection(setup.getMinimum());
scale.setPageIncrement(setup.getTickSpacing());
scale.setToolTipText(setup.getToolTipText());
scale.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
fireInputChanged(getSelection());
}
});
}
示例6: createScale
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
/**
*
* @param shell : the Shell object used
* @param intMin : the Integer minimum value of the scale bar
* @param intMax : the Integer maximum value of the scale bar
* @param intIncrements : the Integer number of increments
* @param intPageIncrement : the Integer step of the scale bar
* @param intSetSelection : the Integer initial value of the slider
* @return Scale widget
*/
public Scale createScale(Shell shell, int intMin, int intMax, int intIncrements, int intPageIncrement, int intSetSelection) {
Scale myScale = new Scale(shell, SWT.HORIZONTAL);
myScale.setMinimum(intMin);
myScale.setMaximum(intMax);
myScale.setIncrement(intIncrements);
myScale.setPageIncrement(intPageIncrement);
myScale.setSelection(intSetSelection);
return myScale;
}
示例7: load
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
public void load()
{
for (String key : mapScales.keySet())
{
Scale scale = mapScales.get(key);
int value = (int)(100*SomoxConfigurationUtil.getMetricValueByKey(key, alternative.getSomoxConfiguration()));
scale.setSelection(value);
}
bindingContext.updateTargets();
}
示例8: createRankGroup
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
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();
}
示例9: createScale
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
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);
}
示例10: createControl
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
/**
* Create contents of the wizard.
*
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new GridLayout(2, false));
Label lbl = new Label(container, SWT.NONE);
lbl.setText(Messages.ReportTemplatesWizardPage_zoom);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_HORIZONTAL);
lbl.setLayoutData(gd);
scale = new Scale(container, SWT.NONE);
scale.setMinimum(1);
scale.setMaximum(50);
scale.setIncrement(1);
scale.setPageIncrement(5);
SashForm sashForm = new SashForm(container, SWT.NONE);
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
// list = new org.eclipse.swt.widgets.List(sashForm, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
Table table = new Table(sashForm, SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
gd.widthHint = 150;
scale.setLayoutData(gd);
galleryComposite = new Composite(sashForm, SWT.NONE);
layout = new StackLayout();
galleryComposite.setLayout(layout);
categoryList = BuiltInCategories.getCategoriesList();
for (String cat : categoryList) {
cachedGalleries.put(cat, null);
}
bundles = StudioTemplateManager.getInstance().getTemplateBundles();
findTemplates();
// initializeBackgroundData();
sashForm.setWeights(new int[] { 20, 80 });
scale.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
zoomModified();
}
});
container.addMouseWheelListener(scaleListener);
//galleryComposite.addMouseWheelListener(scaleListener);
scale.setSelection(6);
// Manually fire the event because the invocation
// of #Scale.selection() does not fire it.
zoomModified();
createTableColumn(table);
showGallery(categoryList.get(0));
}
示例11: createParameterArea
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
protected void createParameterArea(Composite parent) {
GridLayout gl = new GridLayout();
gl.numColumns = 2;
parent.setLayout(gl);
_repeatHeader = new Button(parent, SWT.CHECK);
_repeatHeader.setSelection(_configuration.getRepeatHeader());
_repeatHeader.setText("Repeat header");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
_repeatHeader.setLayoutData(gd);
final Label scaleText = new Label(parent, SWT.RIGHT);
scaleText.setText(getScaleText());
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
scaleText.setLayoutData(gd);
final Scale scale = new Scale(parent, SWT.HORIZONTAL);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
scale.setLayoutData(gd);
scale.setMaximum(1000);
scale.setMinimum(10);
scale.setSelection((int) (_configuration.getScale() * 100));
scale.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent ev) {
int val = scale.getSelection();
double s = (double) val / 100.0;
_configuration.setScale(s);
scaleText.setText(getScaleText());
updateConf();
}
public void widgetDefaultSelected(SelectionEvent arg0) {
}
});
_pagesLabel = new Label(parent, SWT.RIGHT);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
_pagesLabel.setLayoutData(gd);
_printerData = _pdatas[_printerCombo.getSelectionIndex()];
Printer printer = new Printer(_printerData);
_tablePrinter.setPrinter(printer);
Point pages = _tablePrinter.calculatePageCount(_configuration);
printer.dispose();
_pagesLabel.setText(getPagesText(pages));
}
示例12: createPartControl
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
public void createPartControl(Composite parent) {
SashForm form = new SashForm(parent, SWT.NONE);
Composite dataComp = new Composite(form, SWT.NONE);
dataComp.setLayout(new GridLayout(1, false));
Label lblDebugTargets = new Label(dataComp, SWT.NONE);
lblDebugTargets.setText("Array Expressions:");
treeWatchedVariables = new TreeViewer(dataComp, SWT.BORDER);
treeWatchedVariables.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
Composite viewsComp = new Composite(form, SWT.NONE);
viewsComp.setLayout(new GridLayout(1, false));
Composite viewsHeader = new Composite(viewsComp, SWT.NONE);
viewsHeader.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
GridLayout headerLayout = new GridLayout(8, false);
headerLayout.marginTop = headerLayout.marginBottom = headerLayout.marginHeight = 0;
viewsHeader.setLayout(headerLayout);
Label lblShowAs = new Label(viewsHeader, SWT.NONE);
lblShowAs.setText("View as:");
buttonSeries = new Button(viewsHeader, SWT.RADIO | SWT.SELECTED);
buttonSeries.setText("Series");
buttonSeries.setSelection(true);
buttonHistogram = new Button(viewsHeader, SWT.RADIO);
buttonHistogram.setText("Histogram");
buttonTable = new Button(viewsHeader, SWT.RADIO);
buttonTable.setText("Table");
Label lblFullTextSearch = new Label(viewsHeader, SWT.NONE);
lblFullTextSearch.setText("Instant Text Search:");
lblFullTextSearch.setAlignment(SWT.FILL);
txtFullTextSearch = new Text(viewsHeader, SWT.SINGLE);
Label lblZoom = new Label(viewsHeader, SWT.NONE);
lblZoom.setText("Zoom:");
sliderZoom = new Scale(viewsHeader, SWT.NONE);
sliderZoom.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
sliderZoom.setMinimum(0);
sliderZoom.setSelection(10);
sliderZoom.setMaximum(20);
compViews = new ScrolledComposite(viewsComp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
compViews.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
viewsArea = new SashForm(compViews, SWT.NONE);
viewsArea.setOrientation(SWT.VERTICAL);
compViews.setContent(viewsArea);
form.setWeights(new int[]{1, 3});
compViews.setExpandHorizontal(true);
compViews.setExpandVertical(true);
compViews.addControlListener( new ControlAdapter() {
@Override
public void controlResized( ControlEvent e ) {
ScrollBar sbX = compViews.getHorizontalBar();
if ( sbX != null ) {
sbX.setPageIncrement( sbX.getThumb() );
sbX.setIncrement( Math.max( 1, sbX.getThumb() / 5 ) );
}
}
});
}
示例13: createContents
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
@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);
}
示例14: onScaleDoubleClick
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
private void onScaleDoubleClick(final Widget widget) {
final Scale scale = (Scale) widget;
final int max = scale.getMaximum();
scale.setSelection(max / 2);
onModifyProperties();
}
示例15: onDoubleClickGeoPos
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
private void onDoubleClickGeoPos(final Widget widget) {
final Scale scale = (Scale) widget;
final int max = scale.getMaximum();
scale.setSelection(max / 2);
onSelectSlicePosition();
}