本文整理汇总了Java中org.eclipse.swt.widgets.Spinner.setLayoutData方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.setLayoutData方法的具体用法?Java Spinner.setLayoutData怎么用?Java Spinner.setLayoutData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Spinner
的用法示例。
在下文中一共展示了Spinner.setLayoutData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: LinesPerPageDialog
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private LinesPerPageDialog(Shell parentShell)
{
shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setText("Lines per Page");
shell.setLayout(new GridLayout(3, true));
spinner = new Spinner(shell, 0);
spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
spinner.setValues(bzStyledText.getLinesPerPage(), 0, 225, 0, 1, 10);
spinner.addKeyListener(this);
okButton = new Button(shell, SWT.PUSH);
okButton.setText("OK");
okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
okButton.addSelectionListener(this);
cancelButton = new Button(shell, SWT.PUSH);
cancelButton.setText("Cancel");
cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
cancelButton.addSelectionListener(this);
shell.pack();
shell.open();
}
示例3: CharsPerLineDialog
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private CharsPerLineDialog(Shell parentShell)
{
shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setText("Characters Per Line");
shell.setLayout(new GridLayout(3, true));
spinner = new Spinner(shell, 0);
spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
spinner.setValues(bzStyledText.getCharsPerLine(), 0, 27720, 0, 1, 10);
spinner.addKeyListener(this);
okButton = new Button(shell, SWT.PUSH);
okButton.setText("OK");
okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
okButton.addSelectionListener(this);
cancelButton = new Button(shell, SWT.PUSH);
cancelButton.setText("Cancel");
cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
cancelButton.addSelectionListener(this);
shell.pack();
shell.open();
}
示例4: LineMarginBellDialog
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private LineMarginBellDialog(Shell parentShell)
{
shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setText("Bell Margin");
shell.setLayout(new GridLayout(3, true));
spinner = new Spinner(shell, 0);
spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
spinner.setValues(bzStyledText.getLineMarginBell(), 0, 27720, 0, 1, 10);
spinner.addKeyListener(this);
okButton = new Button(shell, SWT.PUSH);
okButton.setText("OK");
okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
okButton.addSelectionListener(this);
cancelButton = new Button(shell, SWT.PUSH);
cancelButton.setText("Cancel");
cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
cancelButton.addSelectionListener(this);
shell.pack();
shell.open();
}
示例5: PageMarginBellDialog
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private PageMarginBellDialog(Shell parentShell)
{
shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setText("Bell Page");
shell.setLayout(new GridLayout(3, true));
spinner = new Spinner(shell, 0);
spinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
spinner.setValues(bzStyledText.getPageMarginBell(), 0, 27720, 0, 1, 10);
spinner.addKeyListener(this);
okButton = new Button(shell, SWT.PUSH);
okButton.setText("OK");
okButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
okButton.addSelectionListener(this);
cancelButton = new Button(shell, SWT.PUSH);
cancelButton.setText("Cancel");
cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
cancelButton.addSelectionListener(this);
shell.pack();
shell.open();
}
示例6: 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;
}
示例7: createSpinner
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
/**
* @param parent
* @param min
* @param max
* @param hspan
* @param style
* @return
*/
public static Spinner createSpinner(Composite parent, int min, int max, int hspan, int style)
{
Spinner spinner = new Spinner(parent, SWT.BORDER | style);
spinner.setMinimum(min);
spinner.setMaximum(max);
GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false, hspan, 1);
PixelConverter pc = new PixelConverter(spinner);
// See http://jira.appcelerator.org/browse/APSTUD-3215
// We need to add some extra spacing to the MacOSX spinner in order to adjust the size to the way Mac draws
// spinners.
int extraWidth = Platform.OS_MACOSX.equals(Platform.getOS()) ? 25 : 0;
gd.widthHint = pc.convertWidthInCharsToPixels(2) + extraWidth;
spinner.setLayoutData(gd);
return spinner;
}
示例8: createCommun_trigger
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
/**
* This method initializes commun_trigger
*
*/
private void createCommun_trigger() {
commun_trigger = new Composite(this, SWT.NONE);
GridData gridData1 = new GridData();
gridData1.verticalAlignment = GridData.CENTER;
gridData1.horizontalAlignment = GridData.FILL;
gridData1.grabExcessHorizontalSpace = true;
commun_trigger.setLayoutData(gridData1);
GridLayout gridLayout = new GridLayout();
gridLayout.makeColumnsEqualWidth = false;
gridLayout.numColumns = 2;
commun_trigger.setLayout(gridLayout);
type_trigger_label = new Label(commun_trigger, SWT.NONE);
type_trigger_label.setText("Type of synchronizer");
createType_trigger_combo();
timeout_label = new Label(commun_trigger, SWT.NONE);
timeout_label.setText("Timeout (ms)");
timeout_spin = new Spinner(commun_trigger, SWT.BORDER);
timeout_spin.setMinimum(0);
timeout_spin.setMaximum(Integer.MAX_VALUE);
timeout_spin.setSelection((int) trigger.getTimeout());
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.CENTER;
gridData.grabExcessHorizontalSpace = true;
timeout_spin.setLayoutData(gridData);
}
示例9: makeSpinner
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private Spinner makeSpinner(Composite parent,String label,int value, int min, int max){
this.newLabel(parent,label);
Spinner spinner = new Spinner(parent,SWT.BORDER);
spinner.setMinimum(min);
spinner.setMaximum(max);
spinner.setSelection(value);
spinner.setLayoutData(getGridData());
return spinner;
}
示例10: createSpinner
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private Spinner createSpinner(Composite parent, String label, boolean isFloat, String propertyName) {
Label l = new Label(parent, SWT.LEFT);
l.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
l.setText(label);
Spinner sp = new Spinner(parent, SWT.BORDER);
sp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
if (propertyName!=null && !propertyName.isEmpty())
sp.setData("propertyName", propertyName);
// set the minimum value to 0.1
sp.setMinimum(0);
// set the maximum value to 20
sp.setMaximum((int) 1e6);
if (isFloat) {
// allow 3 decimal places
sp.setDigits(FLOAT_DIGITS);
sp.setIncrement(FLOAT_MULTIPLICATOR);
// sp.setSelection(FLOAT_MULTIPLICATOR);
} else {
sp.setIncrement(0);
sp.setIncrement(1);
// sp.setSelection(1);
}
sp.setSelection(0);
sp.pack();
return sp;
}
示例11: EmptyDataAdapterComposite
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
/**
* Create the composite.
*
* @param parent
* @param style
*/
public EmptyDataAdapterComposite(Composite parent, int style, JasperReportsContext jrContext) {
super(parent, style, jrContext);
setLayout(new GridLayout(2, false));
Label lblNewLabel = new Label(this, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lblNewLabel.setText(Messages.EmptyDataAdapterComposite_0);
spinnerRecords = new Spinner(this, SWT.BORDER);
spinnerRecords.setValues(0, 0, Integer.MAX_VALUE, 0, 1, 10);
spinnerRecords.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
示例12: 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();
}
});
}
示例13: createDialogArea
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
/**
* Create the widgets for the main composite for the Dialog
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(4, false));
Label totalLabel = new Label(container, SWT.NONE);
totalLabel.setText("Quantity");
quantitySpinner = new Spinner(container, SWT.BORDER);
quantitySpinner.setLayoutData(
new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
quantitySpinner.setValues(1, 1, 10000, 0, 1, 10);
new Label(container, SWT.NONE);
// Create the X, Y, Z coordinate labels
Label labelX = new Label(container, SWT.NONE);
labelX.setLayoutData(
new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
labelX.setText("X");
Label labelY = new Label(container, SWT.NONE);
labelY.setLayoutData(
new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
labelY.setText("Y");
Label labelZ = new Label(container, SWT.NONE);
labelZ.setLayoutData(
new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
labelZ.setText("Z");
// Create the shift label
Label shiftLabel = new Label(container, SWT.NONE);
shiftLabel.setText("Shift");
// Create the X, Y, Z shift spinners
for (int i = 0; i < 3; i++) {
shiftSpinners[i] = new RealSpinner(container);
shiftSpinners[i].setBounds(-1.0e6, 1.0e6);
shiftSpinners[i].getControl().setLayoutData(
new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
return container;
}
示例14: createControl
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
public void createControl(Composite parent) {
// inherit default container and name specification widgets
super.createControl(parent);
final Composite composite = (Composite)getControl();
// sample section generation group
final Group group = new Group(composite,SWT.NONE);
group.setLayout(new GridLayout(2,false));
group.setText("Traceability algorithm parameter(LSA)");
group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
Label nameLabel = new Label(group, SWT.NONE);
nameLabel.setText("Dimensions:");
dimensions = new Spinner(group, SWT.BORDER); // use desired style
dimensions.setMinimum(50);
dimensions.setMaximum(300);
dimensions.setSelection(DIMENSIONS);
dimensions.setIncrement(1);
dimensions.setPageIncrement(10);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
dimensions.setLayoutData(gridData);
Label thresholdLabel = new Label(group, SWT.NONE);
thresholdLabel.setText("Threshold:");
gridData = new GridData();
gridData.verticalAlignment = SWT.TOP;
thresholdLabel.setLayoutData(gridData);
threshold = new Spinner(group, SWT.NONE);
// allow 3 decimal places
threshold.setDigits(3);
// set the minimum value to 0.001
threshold.setMinimum(1);
// set the maximum value to 20
threshold.setMaximum(1000);
// set the increment value to 0.010
threshold.setIncrement(10);
// set the seletion to 3.456
threshold.setSelection(THRESHOLD);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
threshold.setLayoutData(gridData);
}
开发者ID:germanattanasio,项目名称:traceability-assistant-eclipse-plugins,代码行数:50,代码来源:TraceCreationPage.java
示例15: createDialogArea
import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
this.composite = (Composite) super.createDialogArea(parent);
composite.setBackground(ColorConstants.white);
final int numberOfColumns = PeriodPropertyElement.values().length * 2;
final GridLayout gridLayout = new GridLayout(numberOfColumns, false);
composite.setLayout(gridLayout);
GridData data;
final Label instructionLabel = toolkit.createLabel(composite, "Specify a value for the period");
data = new GridData();
data.horizontalSpan = numberOfColumns;
instructionLabel.setLayoutData(data);
if (this.help != null) {
final Label helpShort = toolkit.createLabel(composite, help.displayHelpShort());
data = new GridData();
data.horizontalSpan = numberOfColumns;
helpShort.setLayoutData(data);
final Label helpLong = toolkit.createLabel(composite, help.displayHelpLong());
data = new GridData();
data.horizontalSpan = numberOfColumns;
helpLong.setLayoutData(data);
}
int i = 0;
PeriodPropertyElement[] properties = PeriodPropertyElement.values();
for (final PeriodPropertyElement element : properties) {
final Spinner spinner = new Spinner(composite, SWT.BORDER);
spinner.setData("PERIOD_KEY", element.getShortFormat());
if (StringUtils.isNotBlank(originalValue)) {
spinner.setSelection(ExtensionPropertyUtil.getPeriodPropertyElementFromValue(originalValue, element));
}
spinner.setEnabled(true);
data = new GridData();
data.widthHint = 30;
spinner.setLayoutData(data);
String labelText = element.getLongFormat();
if (i != properties.length - 1) {
labelText += " , ";
}
Label labelShort = toolkit.createLabel(composite, labelText, SWT.NONE);
labelShort.setToolTipText(element.getLongFormat());
i++;
}
return composite;
}