本文整理汇总了Java中org.eclipse.swt.widgets.Spinner.addModifyListener方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.addModifyListener方法的具体用法?Java Spinner.addModifyListener怎么用?Java Spinner.addModifyListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Spinner
的用法示例。
在下文中一共展示了Spinner.addModifyListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
Label labelDescription = new Label(composite, SWT.WRAP);
labelDescription.setText("Limit chars logs");
final Spinner spinnerBox = new Spinner(composite, SWT.WRAP);
spinnerBox.setMaximum(MAX_LOG_CHARS);
spinnerBox.setMinimum(MIN_LOG_CHARS);
spinnerBox.setSelection(limitLogsChars);
spinnerBox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
spinnerBox.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
limitLogsChars = Integer.parseInt(spinnerBox.getText());
}
});
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite.setLayout(new GridLayout(2, false));
return composite;
}
示例2: createWidgets
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
@Override
protected void createWidgets(String text, String toolTip, Integer initialValue) {
lbl = new Label(this, SWT.NONE);
lbl.setText(text);
spinner = new Spinner(this, SWT.CHECK);
spinner.setToolTipText(toolTip);
spinner.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
Integer value = spinner.getSelection();
if (value != getValue()) {
setValue(value, false);
}
}
});
}
示例3: createWidgets
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
@Override
protected void createWidgets(String text, String toolTip, Double initialValue) {
lbl = new Label(this, SWT.NONE);
lbl.setText(text);
spinner = new Spinner(this, SWT.CHECK);
spinner.setToolTipText(toolTip);
spinner.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
double value = spinner.getSelection() / scale;
if (value != getValue()) {
setValue(value, false);
}
}
});
}
示例4: createRadio
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
/**
* Create a radio button followed by a spinner with a maximum and a minimum value. At the radio
* button can be associated a governor. This object define how the color picker area is painted.
* This is done because when a button is selected its governor is set into the color picker widget
* changing the color space. When a radio button created with this method is selected all the other
* are deselected.
*
* @param parent parent of the controls
* @param title content of a label placed as text of the radio button
* @param suffix content of a label placed after the spinner
* @param governor the governor that is loaded in the color picker widget when the button is selected
* @param defaultEnabled true if the radio button is enabled by default, false otherwise
* @param min min int value for the spinner
* @param max max int value for the spinner
* @return the spinner created
*/
private Spinner createRadio(Composite parent, String title, String suffix, IWidgetGovernor governor, boolean defaultEnabled, int min, int max){
final Button radio = new Button(parent, SWT.RADIO);
radioList.add(radio);
radio.setText(title);
radio.setData(governor);
radio.setSelection(defaultEnabled);
radio.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (radio.getSelection()){
disableAllRadioExceptOne(radio);
colorsSelector.setGovernor((IWidgetGovernor)radio.getData());
}
}
});
Spinner actualText = new Spinner(parent, SWT.BORDER);
actualText.setMinimum(min);
actualText.setMaximum(max);
actualText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (suffix != null) new Label(parent, SWT.NONE).setText(suffix);
else new Label(parent, SWT.NONE);
actualText.addModifyListener(valueModifedListener);
return actualText;
}
示例5: createComponent
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
@Override
protected void createComponent(Composite parent) {
controlSpinner = new Spinner(parent, SWT.BORDER);
controlSpinner.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
section.changeProperty(pDescriptor.getId(), controlSpinner.getSelection());
}
});
}
示例6: createInput
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
@Override
public void createInput(Composite parent, final IParameter param, final Map<String, Object> params) {
super.createInput(parent, param, params);
Class<?> valueClass = param.getValueClass();
if (Number.class.isAssignableFrom(param.getValueClass())) {
min = 0;
max = 0;
digits = 0;
increment = 1;
pageIncrement = 10;
if (valueClass.equals(Integer.class)) {
min = Integer.MIN_VALUE;
max = Integer.MAX_VALUE;
} else if (valueClass.equals(Short.class)) {
min = (int) Short.MIN_VALUE;
max = (int) Short.MAX_VALUE;
} else if (valueClass.equals(Byte.class)) {
min = (int) Byte.MIN_VALUE;
max = (int) Byte.MAX_VALUE;
}
num = new Spinner(parent, SWT.BORDER);
num.addFocusListener(focusListener);
num.setToolTipText(VParameters.createToolTip(param));
updateInput();
final ModifyListener listener2 = new ModifyListener() {
public void modifyText(ModifyEvent e) {
num.removeModifyListener(this);
Number n = null;
if (param.getValueClass().equals(Integer.class)) {
n = new Integer(Misc.nvl(num.getText()));
} else if (param.getValueClass().equals(Byte.class)) {
n = new Byte(Misc.nvl(num.getText()));
} else if (param.getValueClass().equals(Short.class)) {
n = new Short(Misc.nvl(num.getText()));
}
updateModel(n);
updateInput();
num.addModifyListener(this);
}
};
num.addModifyListener(listener2);
if (param.getMinValue() != null) {
int minval = new Integer(param.getMinValue()).intValue();
if (!param.isStrictMin())
minval++;
num.setMinimum(minval);
}
if (param.getMaxValue() != null) {
int maxval = new Integer(param.getMaxValue()).intValue();
if (!param.isStrictMax())
maxval--;
num.setMaximum(maxval);
}
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalIndent = 8;
num.setLayoutData(gd);
setMandatory(param, num);
setNullable(param, num);
}
}
示例7: createUI_10_Toolbar
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private void createUI_10_Toolbar(final Composite parent) {
_toolbar = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults()//
.grab(true, false)
.align(SWT.BEGINNING, SWT.FILL)
.applyTo(_toolbar);
GridLayoutFactory.fillDefaults()//
.numColumns(6)
.margins(3, 3)
.applyTo(_toolbar);
// container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
{
/*
* label: hr min
*/
_lblHrMin = new Label(_toolbar, SWT.NONE);
GridDataFactory.fillDefaults()//
// .indent(5, 0)
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(_lblHrMin);
_lblHrMin.setText(Messages.Training_View_Label_LeftChartBorder);
_lblHrMin.setToolTipText(Messages.Training_View_Label_LeftChartBorder_Tooltip);
/*
* spinner: hr min
*/
_spinnerHrLeft = new Spinner(_toolbar, SWT.BORDER);
_spinnerHrLeft.setMinimum(HR_LEFT_MIN_BORDER);
_spinnerHrLeft.setMaximum(HR_RIGHT_MAX_BORDER);
_spinnerHrLeft.addModifyListener(_defaultSpinnerModifyListener);
_spinnerHrLeft.addSelectionListener(_defaultSpinnerSelectionListener);
_spinnerHrLeft.addMouseWheelListener(_defaultSpinnerMouseWheelListener);
/*
* label: hr max
*/
_lblHrMax = new Label(_toolbar, SWT.NONE);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(_lblHrMax);
_lblHrMax.setText(Messages.Training_View_Label_RightChartBorder);
_lblHrMax.setToolTipText(Messages.Training_View_Label_RightChartBorder_Tooltip);
/*
* spinner: hr max
*/
_spinnerHrRight = new Spinner(_toolbar, SWT.BORDER);
_spinnerHrRight.setMinimum(HR_LEFT_MIN_BORDER);
_spinnerHrRight.setMaximum(HR_RIGHT_MAX_BORDER);
_spinnerHrRight.addModifyListener(_defaultSpinnerModifyListener);
_spinnerHrRight.addSelectionListener(_defaultSpinnerSelectionListener);
_spinnerHrRight.addMouseWheelListener(_defaultSpinnerMouseWheelListener);
/*
* toolbar actions
*/
final ToolBar toolbar = new ToolBar(_toolbar, SWT.FLAT);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.CENTER)
.applyTo(toolbar);
_headerToolbarManager = 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);
}
示例8: 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);
}