本文整理匯總了Java中org.eclipse.swt.widgets.Spinner.addSelectionListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Spinner.addSelectionListener方法的具體用法?Java Spinner.addSelectionListener怎麽用?Java Spinner.addSelectionListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Spinner
的用法示例。
在下文中一共展示了Spinner.addSelectionListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createControl
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
@Override
protected Control createControl(Composite parent) {
spinner = new Spinner(parent, style);
spinner.setBackground(parent.getBackground());
spinner.setMinimum(minimum);
spinner.setMaximum(maximum);
spinner.setSelection(selection);
spinner.setIncrement(increment);
if (selectionListeners != null) {
for (SelectionListener l : selectionListeners) {
spinner.addSelectionListener(l);
}
}
return spinner;
}
示例2: createFormContent
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
@Override
protected void createFormContent(IManagedForm mform) {
mform.getForm().setText("Guide Position");
FormToolkit toolkit = mform.getToolkit();
mform.getForm().getBody().setLayout(new GridLayout(4, false));
toolkit.createLabel(mform.getForm().getBody(), "Guide Position"); //$NON-NLS-1$
final Spinner width = new Spinner(mform.getForm().getBody(), SWT.BORDER);
width.setValues(w, 0, Integer.MAX_VALUE, 0, 1, 10);
width.setToolTipText("Guide Position");
width.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
w = width.getSelection();
}
});
}
示例3: createUI_Margin
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private Spinner createUI_Margin(final Composite parent) {
final Spinner spinner = new Spinner(parent, SWT.BORDER);
spinner.setMinimum(CalendarProfileManager.DEFAULT_MARGIN_MIN);
spinner.setMaximum(CalendarProfileManager.DEFAULT_MARGIN_MAX);
spinner.addSelectionListener(_defaultSelectionListener);
spinner.addMouseWheelListener(_defaultMouseWheelListener);
// ensure that the -- sign is displayed
GridDataFactory
.fillDefaults()
.hint(_pc.convertWidthInCharsToPixels(3), SWT.DEFAULT)
.applyTo(spinner);
return spinner;
}
示例4: createUI_22_SmoothGradient
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void createUI_22_SmoothGradient(final Composite parent) {
/*
* image: gradient
*/
_iconGradient = new CLabel(parent, SWT.NONE);
GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconGradient);
_iconGradient.setBackground(_tk.getColors().getBackground());
_iconGradient.setImage(_imageGradient);
/*
* label: smooth gradient
*/
final Label label = _tk.createLabel(parent, Messages.TourChart_Smoothing_Label_GradientSmoothing, SWT.CHECK);
GridDataFactory.fillDefaults() //
.align(SWT.FILL, SWT.CENTER)
.applyTo(label);
label.setToolTipText(Messages.TourChart_Smoothing_Label_GradientSmoothing_Tooltip);
/*
* spinner: gradient tau
*/
_spinnerGradientTau = new Spinner(parent, SWT.BORDER);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.FILL)
.applyTo(_spinnerGradientTau);
_spinnerGradientTau.setDigits(1);
_spinnerGradientTau.setMinimum(1);
_spinnerGradientTau.setMaximum(MAX_TAU);
_spinnerGradientTau.addSelectionListener(_selectionListener);
_spinnerGradientTau.addMouseWheelListener(_spinnerMouseWheelListener);
}
示例5: createUI_48_SegmenterBy_MinAltitude
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private Composite createUI_48_SegmenterBy_MinAltitude(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(5).applyTo(container);
{
// label: min alti diff
final Label label = new Label(container, SWT.NONE);
label.setText(Messages.tour_segmenter_segType_byUpDownAlti_label);
// spinner: minimum altitude
_spinnerMinAltitude = new Spinner(container, SWT.BORDER);
GridDataFactory.fillDefaults().applyTo(_spinnerMinAltitude);
_spinnerMinAltitude.setMinimum(1); // 0.1
_spinnerMinAltitude.setMaximum(10000); // 1000
_spinnerMinAltitude.setDigits(1);
_spinnerMinAltitude.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
createSegments(true);
}
});
_spinnerMinAltitude.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseScrolled(final MouseEvent event) {
UI.adjustSpinnerValueOnMouseScroll(event);
onSelect_BreakTime();
}
});
// label: unit
_lblMinAltitude = new Label(container, SWT.NONE);
_lblMinAltitude.setText(net.tourbook.common.UI.UNIT_LABEL_ALTITUDE);
_lblAltitudeUpMin = createUI_DP_Info(container);
_btnSaveTourMin = createUI_DB_SaveTour(container);
}
return container;
}
示例6: createUI_56_Field_Height
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
/**
* field: height
*/
private void createUI_56_Field_Height(final Composite parent) {
Label label = new Label(parent, SWT.NONE);
label.setText(Messages.Pref_People_Label_height);
final Composite containerHeight = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
.applyTo(containerHeight);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(containerHeight);
{
// spinner: height
_spinnerHeight = new Spinner(containerHeight, SWT.BORDER);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.FILL)
// .hint(_spinnerWidth, SWT.DEFAULT)
.applyTo(_spinnerHeight);
_spinnerHeight.setDigits(2);
_spinnerHeight.setMinimum(0);
_spinnerHeight.setMaximum(300); // 3.00 m
_spinnerHeight.addSelectionListener(_defaultSelectionListener);
_spinnerHeight.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseScrolled(final MouseEvent event) {
UI.adjustSpinnerValueOnMouseScroll(event);
onModifyPerson();
}
});
// label: unit
label = new Label(containerHeight, SWT.NONE);
label.setText(UI.UNIT_METER);
}
// filler
new Label(parent, SWT.NONE);
}
示例7: createUI_20_GPSSpeed
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void createUI_20_GPSSpeed(final Composite container) {
{
// Label: Speed for GPS devices
final Label label = _tk.createLabel(container, Messages.Compute_TourValueSpeed_Title);
GridDataFactory.fillDefaults().span(2, 1).applyTo(label);
}
{
/*
* Speed &Time Slice:
*/
// Label
_tk.createLabel(container, Messages.compute_tourValueSpeed_label_speedTimeSlice);
final Composite valueContainer = _tk.createComposite(container);
GridDataFactory.fillDefaults().grab(true, false).applyTo(valueContainer);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(valueContainer);
{
// Combo
_spinnerSpeedMinTime = new Spinner(valueContainer, SWT.BORDER);
GridDataFactory.fillDefaults()//
.applyTo(_spinnerSpeedMinTime);
_spinnerSpeedMinTime.setMaximum(1000);
_spinnerSpeedMinTime.addSelectionListener(_defaultSelectionListener);
_spinnerSpeedMinTime.addMouseWheelListener(_defaultMouseWheelListener);
// label: unit
_tk.createLabel(valueContainer, Messages.app_unit_seconds);
}
}
}
示例8: loadSelectIntegerWidget
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void loadSelectIntegerWidget(BTSConfigItem itemConfig2,
BTSPassportEntry entry) {
Label label = new Label(this, SWT.NONE);
label.setText(getLabel(itemConfig));
label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false,
BTSUIConstants.PASSPORT_COLUMN_NUMBER / 2, 1));
((GridData) label.getLayoutData()).verticalIndent = 2;
// label.pack();
spinner = new Spinner(this, SWT.BORDER);
spinner.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,
BTSUIConstants.PASSPORT_COLUMN_NUMBER / 2,
1));
((GridData) spinner.getLayoutData()).horizontalIndent = 7;
if (itemConfig2.getDescription() != null
&& !itemConfig2.getDescription().getLanguages().isEmpty()) {
final ControlDecoration deco = new ControlDecoration(spinner,
SWT.BOTTOM | SWT.LEFT);
// re-use an existing image
Image image = FieldDecorationRegistry
.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION)
.getImage();
// set description and image
deco.setDescriptionText(itemConfig2.getDescription()
.getTranslation(lang));
deco.setImage(image);
}
DataBindingContext bindingContext = new DataBindingContext();
EMFUpdateValueStrategy targetToModel = new EMFUpdateValueStrategy();
targetToModel.setConverter(new BTSIntegerToStringConverter());
if (itemConfig.getPassportEditorConfig().isRequired()) {
targetToModel.setBeforeSetValidator(new StringNotEmptyValidator());
}
EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy();
modelToTarget.setConverter(new BTSStringToIntegerConverter());
Binding binding = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(
BTSUIConstants.DELAY, spinner),
EMFEditProperties.value(editingDomain,
BtsCorpusModelPackage.Literals.BTS_PASSPORT_ENTRY__VALUE)
.observe(entry), targetToModel, modelToTarget);
if (itemConfig.getPassportEditorConfig().isRequired()) {
bindingContext.addValidationStatusProvider(binding);
BackgroundControlDecorationSupport.create(binding, SWT.TOP
| SWT.LEFT);
}
//remove focus after selection to avoid mousewheel errors
spinner.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getParent().setFocus();
}
});
}
示例9: createUI_53_BreakBySliceSpeed
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private Composite createUI_53_BreakBySliceSpeed(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);
// container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
{
/*
* minimum slice speed
*/
// label: minimum speed
Label label = new Label(container, SWT.NONE);
label.setText(Messages.Compute_BreakTime_Label_MinimumSliceSpeed);
_firstColBreakTime.add(label);
// spinner: minimum speed
_spinnerBreakMinSliceSpeed = new Spinner(container, SWT.BORDER);
GridDataFactory
.fillDefaults()//
.applyTo(_spinnerBreakMinSliceSpeed);
_spinnerBreakMinSliceSpeed.setMinimum(0); // 0.0 km/h
_spinnerBreakMinSliceSpeed.setMaximum(BREAK_MAX_SPEED_KM_H); // 10.0 km/h
_spinnerBreakMinSliceSpeed.setDigits(1);
_spinnerBreakMinSliceSpeed.addSelectionListener(_selectionListener);
_spinnerBreakMinSliceSpeed.addMouseWheelListener(_spinnerMouseWheelListener);
// label: km/h
label = new Label(container, SWT.NONE);
label.setText(net.tourbook.common.UI.UNIT_LABEL_SPEED);
/*
* label: description
*/
label = new Label(container, SWT.WRAP);
GridDataFactory
.fillDefaults()//
.span(3, 1)
.indent(0, DEFAULT_V_DISTANCE_PARAGRAPH)
.hint(DEFAULT_DESCRIPTION_WIDTH, SWT.DEFAULT)
.grab(true, false)
.applyTo(label);
label.setText(Messages.Compute_BreakTime_Label_Description_ComputeBySliceSpeed);
}
return container;
}
示例10: createUI_50_Border
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void createUI_50_Border(final Composite parent) {
/*
* Checkbox: paint with border
*/
{
_chkPaintWithBorder = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults()//
.grab(true, false)
.span(2, 1)
.applyTo(_chkPaintWithBorder);
_chkPaintWithBorder.setText(Messages.pref_map_layout_PaintBorder);
_chkPaintWithBorder.addSelectionListener(_defaultSelectionListener);
}
/*
* border width
*/
{
// label: border width
_lblBorderWidth = new Label(parent, NONE);
GridDataFactory.fillDefaults()//
.indent(_firstColumnIndent, 0)
.applyTo(_lblBorderWidth);
_lblBorderWidth.setText(Messages.pref_map_layout_BorderWidth);
// spinner: border width
_spinnerBorderWidth = new Spinner(parent, SWT.BORDER);
_spinnerBorderWidth.setMinimum(1);
_spinnerBorderWidth.setMaximum(30);
_spinnerBorderWidth.addSelectionListener(_defaultSelectionListener);
_spinnerBorderWidth.addMouseWheelListener(_defaultMouseWheelListener);
}
/*
* Border color
*/
{
// label
_lblBorderColor = new Label(parent, NONE);
GridDataFactory.fillDefaults()//
.indent(_firstColumnIndent, 0)
.align(SWT.FILL, SWT.BEGINNING)
.applyTo(_lblBorderColor);
_lblBorderColor.setText(Messages.Pref_MapLayout_Label_BorderColor);
final Composite containerBorderColor = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
.grab(true, false)
.applyTo(containerBorderColor);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(containerBorderColor);
{
// Radio: darker
_rdoBorderColorDarker = new Button(containerBorderColor, SWT.RADIO);
_rdoBorderColorDarker.setText(Messages.Pref_MapLayout_Checkbox_BorderColor_Darker);
_rdoBorderColorDarker.addSelectionListener(_defaultSelectionListener);
// spinner: border width
_spinnerBorderColorDarker = new Spinner(containerBorderColor, SWT.BORDER);
_spinnerBorderColorDarker.setMinimum(0);
_spinnerBorderColorDarker.setMaximum(100);
_spinnerBorderColorDarker.setPageIncrement(10);
_spinnerBorderColorDarker.addSelectionListener(_defaultSelectionListener);
_spinnerBorderColorDarker.addMouseWheelListener(_defaultMouseWheelListener);
// Radio: color
_rdoBorderColorColor = new Button(containerBorderColor, SWT.RADIO);
_rdoBorderColorColor.setText(Messages.Pref_MapLayout_Checkbox_BorderColor_Color);
_rdoBorderColorColor.addSelectionListener(_defaultSelectionListener);
// border color
_colorBorderColor = new ColorSelector(containerBorderColor);
_colorBorderColor.addListener(_defaultChangePropertyListener);
}
}
}
示例11: createUI_20_Toolbar
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void createUI_20_Toolbar(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
.grab(true, false)
.align(SWT.BEGINNING, SWT.FILL)
.applyTo(container);
GridLayoutFactory.fillDefaults()//
.numColumns(5)
.margins(3, 3)
.applyTo(container);
// container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
{
/*
* label: hr min
*/
_lblMinTime = new Label(container, SWT.NONE);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(_lblMinTime);
_lblMinTime.setText(Messages.HRV_View_Label_LeftChartBorder);
_lblMinTime.setToolTipText(Messages.HRV_View_Label_LeftChartBorder_Tooltip);
/*
* spinner: hr min
*/
_spinnerMinTime = new Spinner(container, SWT.BORDER);
_spinnerMinTime.setMinimum(HRV_TIME_MIN_BORDER);
_spinnerMinTime.setMaximum(HRV_TIME_MAX_BORDER);
_spinnerMinTime.addModifyListener(_defaultSpinnerModifyListener);
_spinnerMinTime.addSelectionListener(_defaultSpinnerSelectionListener);
_spinnerMinTime.addMouseWheelListener(_defaultSpinnerMouseWheelListener);
/*
* label: hr max
*/
_lblMaxTime = new Label(container, SWT.NONE);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(_lblMaxTime);
_lblMaxTime.setText(Messages.HRV_View_Label_RightChartBorder);
_lblMaxTime.setToolTipText(Messages.HRV_View_Label_RightChartBorder_Tooltip);
/*
* spinner: hr max
*/
_spinnerMaxTime = new Spinner(container, SWT.BORDER);
_spinnerMaxTime.setMinimum(HRV_TIME_MIN_BORDER);
_spinnerMaxTime.setMaximum(HRV_TIME_MAX_BORDER);
_spinnerMaxTime.addModifyListener(_defaultSpinnerModifyListener);
_spinnerMaxTime.addSelectionListener(_defaultSpinnerSelectionListener);
_spinnerMaxTime.addMouseWheelListener(_defaultSpinnerMouseWheelListener);
/*
* toolbar actions
*/
final ToolBar toolbar = new ToolBar(container, SWT.FLAT);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(toolbar);
_toolbarManager = new ToolBarManager(toolbar);
}
// // label: horizontal separator
// final Label label = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
// GridDataFactory.fillDefaults()//
// .grab(true, false)
// .hint(SWT.DEFAULT, 1)
// .applyTo(label);
// label.setText(UI.EMPTY_STRING);
}
示例12: createUI_10_Tagging
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void createUI_10_Tagging(final Composite parent) {
final Group group = new Group(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
group.setText(Messages.Pref_Appearance_Group_Tagging);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(group);
{
/*
* number of recent tags
*/
final Label label = new Label(group, NONE);
label.setText(Messages.pref_appearance_number_of_recent_tags);
label.setToolTipText(Messages.pref_appearance_number_of_recent_tags_tooltip);
// spinner
_spinnerRecentTags = new Spinner(group, SWT.BORDER);
GridDataFactory.fillDefaults()//
.hint(_hintDefaultSpinnerWidth, SWT.DEFAULT)
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(_spinnerRecentTags);
_spinnerRecentTags.setToolTipText(Messages.pref_appearance_number_of_recent_tags_tooltip);
_spinnerRecentTags.setMinimum(0);
_spinnerRecentTags.setMaximum(9);
_spinnerRecentTags.addSelectionListener(_defaultSelectionAdapter);
_spinnerRecentTags.addMouseWheelListener(_defaultMouseWheelListener);
/*
* autoopen tagging
*/
// eclipse 3.7 supports this feature
// if (_isOSX) {
// // label: OSX is not supported, feature is not working
// final Label label = new Label(container, SWT.WRAP);
// GridDataFactory.fillDefaults().span(3, 1).applyTo(label);
// label.setText(Messages.Pref_Appearance_Label_NoOSXSupport);
// }
_chkAutoOpenTagging = new Button(group, SWT.CHECK);
GridDataFactory.fillDefaults().span(2, 1).applyTo(_chkAutoOpenTagging);
_chkAutoOpenTagging.setText(Messages.Pref_Appearance_Check_AutoOpenTagging);
_chkAutoOpenTagging.addSelectionListener(_defaultSelectionAdapter);
_chkAutoOpenTagging.setToolTipText(Messages.Pref_Appearance_Label_AutoOpenTagging_Tooltip);
final Composite autoTagContainer = new Composite(group, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, false).indent(16, 0).span(2, 1).applyTo(autoTagContainer);
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(autoTagContainer);
{
// label: delay
_lblAutoTagDelay = new Label(autoTagContainer, SWT.NONE);
_lblAutoTagDelay.setText(Messages.Pref_Appearance_Label_AutoOpenTaggingDelay);
_lblAutoTagDelay.setToolTipText(Messages.Pref_Appearance_Label_AutoOpenTagging_Tooltip);
// spinner
_spinnerAutoOpenDelay = new Spinner(autoTagContainer, SWT.BORDER);
GridDataFactory.fillDefaults()//
.hint(_hintDefaultSpinnerWidth, SWT.DEFAULT)
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(_spinnerAutoOpenDelay);
_spinnerAutoOpenDelay.setMinimum(0);
_spinnerAutoOpenDelay.setMaximum(3000);
_spinnerAutoOpenDelay.addSelectionListener(_defaultSelectionAdapter);
_spinnerAutoOpenDelay.addMouseWheelListener(_defaultMouseWheelListener);
// label: ms
_lblAutoOpenMS = new Label(autoTagContainer, SWT.NONE);
_lblAutoOpenMS.setText(UI.UNIT_MS);
// check: show animation
_chkTaggingAnimation = new Button(autoTagContainer, SWT.CHECK);
GridDataFactory.fillDefaults().span(3, 1).applyTo(_chkTaggingAnimation);
_chkTaggingAnimation.setText(Messages.Pref_Appearance_Check_TaggingAnimation);
_chkTaggingAnimation.addSelectionListener(_defaultSelectionAdapter);
}
}
}
示例13: createUI_64_Brightness
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void createUI_64_Brightness(final Composite parent) {
{
/*
* Max brightness
*/
_lblMaxBrightness = new Label(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
.grab(true, false)
.align(SWT.FILL, SWT.CENTER)
.applyTo(_lblMaxBrightness);
_lblMaxBrightness.setText(LEGENDCOLOR_DIALOG_MAX_BRIGHTNESS_LABEL);
_lblMaxBrightness.setToolTipText(LEGENDCOLOR_DIALOG_MAX_BRIGHTNESS_TOOLTIP);
final Composite containerMax = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(containerMax);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(containerMax);
{
_cboMaxBrightness = new Combo(containerMax, SWT.DROP_DOWN | SWT.READ_ONLY);
_cboMaxBrightness.addSelectionListener(_defaultSelectionAdapter);
_spinMaxBrightness = new Spinner(containerMax, SWT.BORDER);
_spinMaxBrightness.setMinimum(0);
_spinMaxBrightness.setMaximum(100);
_spinMaxBrightness.setPageIncrement(10);
_spinMaxBrightness.addSelectionListener(_defaultSelectionAdapter);
_spinMaxBrightness.addMouseWheelListener(_defaultMouseWheelListener);
}
}
{
/*
* Min brightness
*/
_lblMinBrightness = new Label(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
.grab(true, false)
.align(SWT.FILL, SWT.CENTER)
.applyTo(_lblMinBrightness);
_lblMinBrightness.setText(LEGENDCOLOR_DIALOG_MIN_BRIGHTNESS_LABEL);
_lblMinBrightness.setToolTipText(LEGENDCOLOR_DIALOG_MIN_BRIGHTNESS_TOOLTIP);
final Composite containerMin = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(containerMin);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(containerMin);
{
_cboMinBrightness = new Combo(containerMin, SWT.DROP_DOWN | SWT.READ_ONLY);
_cboMinBrightness.addSelectionListener(_defaultSelectionAdapter);
_spinMinBrightness = new Spinner(containerMin, SWT.BORDER);
_spinMinBrightness.setMinimum(0);
_spinMinBrightness.setMaximum(100);
_spinMinBrightness.setPageIncrement(10);
_spinMinBrightness.addSelectionListener(_defaultSelectionAdapter);
_spinMinBrightness.addMouseWheelListener(_defaultMouseWheelListener);
}
}
}
示例14: createUI_62_RestingHR
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
/**
* field: resting hr
*/
private void createUI_62_RestingHR(final Composite parent) {
Label label = new Label(parent, SWT.NONE);
label.setText(Messages.Pref_People_Label_RestingHR);
final Composite container = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
// .span(2, 1)
.applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container);
{
// spinner: weight
_spinnerRestingHR = new Spinner(container, SWT.BORDER);
GridDataFactory.fillDefaults() //
.align(SWT.BEGINNING, SWT.FILL)
// .hint(_spinnerWidth, SWT.DEFAULT)
.applyTo(_spinnerRestingHR);
_spinnerRestingHR.setMinimum(10);
_spinnerRestingHR.setMaximum(200);
_spinnerRestingHR.addSelectionListener(_defaultSelectionListener);
_spinnerRestingHR.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseScrolled(final MouseEvent event) {
UI.adjustSpinnerValueOnMouseScroll(event);
onModifyPerson();
}
});
// label: unit
label = new Label(container, SWT.NONE);
label.setText(net.tourbook.common.Messages.Graph_Label_Heartbeat_Unit);
}
final Composite containerAge = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
.grab(true, false)
.align(SWT.END, SWT.FILL)
.applyTo(containerAge);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(containerAge);
// containerAge.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
{
/*
* label: age
*/
label = new Label(containerAge, SWT.NONE);
GridDataFactory.fillDefaults()//
.grab(true, true)
.align(SWT.END, SWT.CENTER)
.applyTo(label);
label.setText(Messages.Pref_People_Label_Age);
/*
* label: age years
*/
_lblAgeHr = new Label(containerAge, SWT.NONE);
GridDataFactory.fillDefaults()//
// .hint(convertHeightInCharsToPixels(4), SWT.DEFAULT)
.grab(true, true)
.align(SWT.END, SWT.CENTER)
.applyTo(_lblAgeHr);
}
}
示例15: createUI_580_IL_LastMarker
import org.eclipse.swt.widgets.Spinner; //導入方法依賴的package包/類
private void createUI_580_IL_LastMarker(final Composite parent) {
{
/*
* Checkbox: Last marker
*/
_chkIL_SetLastMarker = new Button(parent, SWT.CHECK);
_chkIL_SetLastMarker.setText(Messages.Dialog_ImportConfig_Checkbox_LastMarker);
_chkIL_SetLastMarker.setToolTipText(Messages.Dialog_ImportConfig_Checkbox_LastMarker_Tooltip);
_chkIL_SetLastMarker.addSelectionListener(_defaultModify_Listener);
GridDataFactory
.fillDefaults()//
.span(2, 1)
.indent(0, 5)
.applyTo(_chkIL_SetLastMarker);
}
{
/*
* Last marker distance
*/
// label
_lblIL_LastMarker = new Label(parent, SWT.NONE);
_lblIL_LastMarker.setText(Messages.Dialog_ImportConfig_Label_LastMarkerDistance);
_lblIL_LastMarker.setToolTipText(Messages.Dialog_ImportConfig_Label_LastMarkerDistance_Tooltip);
GridDataFactory
.fillDefaults()//
.align(SWT.FILL, SWT.CENTER)
.indent(_leftPadding, 0)
.applyTo(_lblIL_LastMarker);
final Composite container = new Composite(parent, SWT.NONE);
// GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container);
{
// spinner: distance 1.1 km
_spinnerIL_LastMarkerDistance = new Spinner(container, SWT.BORDER);
_spinnerIL_LastMarkerDistance.setMaximum(EasyConfig.LAST_MARKER_DISTANCE_MAX / 100);
_spinnerIL_LastMarkerDistance.setMinimum(EasyConfig.LAST_MARKER_DISTANCE_MIN);
_spinnerIL_LastMarkerDistance.setDigits(1);
_spinnerIL_LastMarkerDistance.addMouseWheelListener(_defaultModify_MouseWheelListener);
_spinnerIL_LastMarkerDistance.addSelectionListener(_defaultModify_Listener);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(_spinnerIL_LastMarkerDistance);
// label: unit
_lblIL_LastMarkerDistanceUnit = new Label(container, SWT.NONE);
_lblIL_LastMarkerDistanceUnit.setText(UI.UNIT_LABEL_DISTANCE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(_lblIL_LastMarkerDistanceUnit);
}
}
{
/*
* Marker text
*/
// label
_lblIL_LastMarkerText = new Label(parent, SWT.NONE);
_lblIL_LastMarkerText.setText(Messages.Dialog_ImportConfig_Label_LastMarkerText);
GridDataFactory
.fillDefaults()//
.align(SWT.FILL, SWT.CENTER)
.indent(_leftPadding, 0)
.applyTo(_lblIL_LastMarkerText);
// text
_txtIL_LastMarker = new Text(parent, SWT.BORDER);
GridDataFactory
.fillDefaults()//
.grab(true, false)
.applyTo(_txtIL_LastMarker);
}
}