當前位置: 首頁>>代碼示例>>Java>>正文


Java Spinner.setLayoutData方法代碼示例

本文整理匯總了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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:27,代碼來源:LimitCharsLogsPreferenceDialog.java

示例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();
}
 
開發者ID:MikeGray-APH,項目名稱:BrailleZephyr,代碼行數:25,代碼來源:BZMenu.java

示例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();
}
 
開發者ID:MikeGray-APH,項目名稱:BrailleZephyr,代碼行數:25,代碼來源:BZMenu.java

示例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();
}
 
開發者ID:MikeGray-APH,項目名稱:BrailleZephyr,代碼行數:25,代碼來源:BZMenu.java

示例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();
}
 
開發者ID:MikeGray-APH,項目名稱:BrailleZephyr,代碼行數:25,代碼來源:BZMenu.java

示例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;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:42,代碼來源:AdvancedColorWidget.java

示例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;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:25,代碼來源:SWTFactory.java

示例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);
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:38,代碼來源:HttpTriggerEditorComposite.java

示例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;
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:10,代碼來源:TGChordSettingsDialog.java

示例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;
		
	}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:32,代碼來源:TextStyleTypeWidget.java

示例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));
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:19,代碼來源:EmptyDataAdapterComposite.java

示例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();
				}
			});
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:63,代碼來源:PassportEntryItemEditor.java

示例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;
}
 
開發者ID:eclipse,項目名稱:eavp,代碼行數:52,代碼來源:ReplicateDialog.java

示例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;
}
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:60,代碼來源:PeriodDialog.java


注:本文中的org.eclipse.swt.widgets.Spinner.setLayoutData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。