本文整理汇总了Java中org.eclipse.swt.widgets.Scale.addSelectionListener方法的典型用法代码示例。如果您正苦于以下问题:Java Scale.addSelectionListener方法的具体用法?Java Scale.addSelectionListener怎么用?Java Scale.addSelectionListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Scale
的用法示例。
在下文中一共展示了Scale.addSelectionListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createScale
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
/**
* Creates the scale or slider widget that can be used to quickly traverse
* the timesteps.
*
* @param parent
* The parent Composite for this widget. Assumed not to be
* {@code null}.
* @return The new widget.
*/
private Scale createScale(Composite parent) {
final Scale scale = new Scale(this, SWT.HORIZONTAL);
scale.setMinimum(0);
scale.setIncrement(1);
scale.setMaximum(0);
scale.setToolTipText("Traverses the timesteps");
scale.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// Disable playback.
setPlayback(false, e);
// Get the timestep from the scale widget.
if (setValidTimestep(scale.getSelection())) {
notifyListeners(e);
}
}
});
return scale;
}
示例2: 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());
}
});
}
示例3: createComponent
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
protected void createComponent(Composite parent) {
composite = section.getWidgetFactory().createComposite(parent);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.wrap = true;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.center = true;
composite.setLayout(layout);
scale = new Scale(composite, SWT.HORIZONTAL);
scale.setMinimum(0);
scale.setMaximum(100);
scale.setIncrement(1);
scale.setPageIncrement(5);
RowData rd = new RowData();
rd.width = 100;
scale.setLayoutData(rd);
scale.setToolTipText(pDescriptor.getDescription());
scale.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!isRefresh)
ftext.setText("" + (scale.getSelection() / 100f));
}
});
super.createComponent(composite);
}
示例4: createControls
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
/**
* Creates the controls.
*
* @param parent
* the parent
* @param initialPixelsPerSecond
* the initial pixels per second
*/
protected void createControls(Composite parent, double initialPixelsPerSecond) {
this.setLayout(new GridLayout(1, false));
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 2;
this.setLayoutData(gd);
pixPerSecondsScale = new Scale(this, SWT.HORIZONTAL);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
pixPerSecondsScale.setLayoutData(gd);
this.setPixelsPerSecond(initialPixelsPerSecond);
pixPerSecondsScale.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent arg0) {
}
public void widgetSelected(SelectionEvent ev) {
int val = pixPerSecondsScale.getSelection();
double pps = (((double) val) * pixelsPerSecond) / 100;
for (TimeScaleListener l : listeners) {
l.timeScaleChanged(pps);
}
}
});
}
示例5: 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();
}
示例6: createUI_70_Option_GeoPosition
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
private Composite createUI_70_Option_GeoPosition(final PageBook parent) {
final PixelConverter pc = new PixelConverter(parent);
final int valueWidth = pc.convertWidthInCharsToPixels(4);
Label label;
final Group group = new Group(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
group.setText(Messages.Adjust_Altitude_Group_GeoPosition);
GridLayoutFactory.swtDefaults().numColumns(3).applyTo(group);
{
/*
* label: adjusted slices
*/
label = new Label(group, SWT.NONE);
label.setText(Messages.Adjust_Altitude_Label_GeoPosition_Slices);
/*
* label: slice value
*/
_lblSliceValue = new Label(group, SWT.TRAIL);
GridDataFactory
.fillDefaults()
.align(SWT.END, SWT.CENTER)
.hint(valueWidth, SWT.DEFAULT)
.applyTo(_lblSliceValue);
/*
* scale: slice position
*/
_scaleSlicePos = new Scale(group, SWT.HORIZONTAL);
GridDataFactory.fillDefaults().grab(true, false).applyTo(_scaleSlicePos);
_scaleSlicePos.setMinimum(0);
_scaleSlicePos.setMaximum(MAX_ADJUST_GEO_POS_SLICES * 2);
_scaleSlicePos.setPageIncrement(5);
_scaleSlicePos.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
onSelectSlicePosition();
}
});
_scaleSlicePos.addListener(SWT.MouseDoubleClick, new Listener() {
@Override
public void handleEvent(final Event event) {
onDoubleClickGeoPos(event.widget);
}
});
}
return group;
}
示例7: 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));
}
示例8: onSelect
import org.eclipse.swt.widgets.Scale; //导入方法依赖的package包/类
public static void onSelect(Scale scale, Consumer<SelectionEvent> consumer) {
scale.addSelectionListener(createSelectionListener(consumer));
}