当前位置: 首页>>代码示例>>Java>>正文


Java Spinner.setSelection方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Spinner.setSelection方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.setSelection方法的具体用法?Java Spinner.setSelection怎么用?Java Spinner.setSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Spinner的用法示例。


在下文中一共展示了Spinner.setSelection方法的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: 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;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:19,代码来源:SpinnerContribution.java

示例3: refresh

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
@Override
public void refresh() {

  final String value = getSimpleValueOrDefault();

  if (StringUtils.isNotEmpty(value)) {

    for (final Control childControl : periodControl.getChildren()) {
      if (childControl instanceof Spinner) {
        Spinner actualControl = (Spinner) childControl;
        String periodKey = (String) childControl.getData("PERIOD_KEY");
        PeriodPropertyElement element = PeriodPropertyElement.byShortFormat(periodKey);
        if (element != null) {
          actualControl.setSelection(ExtensionPropertyUtil.getPeriodPropertyElementFromValue(value, element));
        }
      }
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:CustomPropertyPeriodField.java

示例4: onSelectRandomSpinnerMax

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private void onSelectRandomSpinnerMax(final HashMap<WIDGET_KEY, Widget> paraWidgets) {

		/*
		 * ensure the to value is larger than the from value
		 */
		final Spinner minSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_START);
		final Spinner maxSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_END);

		final int fromRand = minSpinner.getSelection();
		final int toRand = maxSpinner.getSelection();

		if (toRand <= fromRand) {

			if (toRand < 1) {
				minSpinner.setSelection(0);
				maxSpinner.setSelection(1);
			} else {
				minSpinner.setSelection(toRand - 1);
			}
		}

		updateUICustomUrl();
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:24,代码来源:DialogMPCustom.java

示例5: onSelectRandomSpinnerMin

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private void onSelectRandomSpinnerMin(final HashMap<WIDGET_KEY, Widget> paraWidgets) {

		/*
		 * ensure the from value is smaller than the to value
		 */
		final Spinner minSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_START);
		final Spinner maxSpinner = (Spinner) paraWidgets.get(WIDGET_KEY.SPINNER_RANDOM_END);

		final int fromRand = minSpinner.getSelection();
		final int toRand = maxSpinner.getSelection();

		if (fromRand >= toRand) {

			if (toRand < MAX_RANDOM) {
				maxSpinner.setSelection(fromRand + 1);
			} else {
				minSpinner.setSelection(toRand - 1);
			}
		}

		updateUICustomUrl();
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:23,代码来源:DialogMPCustom.java

示例6: adjustSpinnerValueOnMouseScroll

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
public static void adjustSpinnerValueOnMouseScroll(final MouseEvent event) {

		boolean isCtrlKey;
		boolean isShiftKey;

		if (IS_OSX) {
			isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
			isShiftKey = (event.stateMask & SWT.MOD3) > 0;
			//			isAltKey = (event.stateMask & SWT.MOD3) > 0;
		} else {
			isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
			isShiftKey = (event.stateMask & SWT.MOD2) > 0;
			//			isAltKey = (event.stateMask & SWT.MOD3) > 0;
		}

		// accelerate with Ctrl + Shift key
		int accelerator = isCtrlKey ? 10 : 1;
		accelerator *= isShiftKey ? 5 : 1;

		final Spinner spinner = (Spinner) event.widget;
		final int valueAdjustment = ((event.count > 0 ? 1 : -1) * accelerator);

		final int oldValue = spinner.getSelection();
		spinner.setSelection(oldValue + valueAdjustment);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:26,代码来源:UI.java

示例7: 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

示例8: fillSynthPolyphonySpinner

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
protected void fillSynthPolyphonySpinner( Spinner spinner ){
	int value = getIntegerValue( MidiSettings.SYNTH_POLYPHONY );
	int[] range = getSynth().getIntegerPropertyRange( MidiSettings.SYNTH_POLYPHONY );
	if( range.length == 2 && range[0] < range[1] ){
		spinner.setMinimum( range[0] );
		spinner.setMaximum( range[1] );
		spinner.setIncrement(1);
		spinner.setPageIncrement(1);
		if( value >= range[0] && value <= range[1] ){
			spinner.setSelection( value );
		}
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:14,代码来源:MidiOutputPortSettings.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: initScaleGroup

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private void initScaleGroup(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;

    final Group scaleGroup = new Group(parent, SWT.NONE);
    scaleGroup.setLayoutData(gridData);
    scaleGroup.setText(ResourceString.getResourceString("label.page.scale.printing"));

    final GridLayout scaleGroupLayout = new GridLayout();
    scaleGroupLayout.marginWidth = 20;
    scaleGroupLayout.horizontalSpacing = 20;
    scaleGroupLayout.numColumns = 3;
    scaleGroup.setLayout(scaleGroupLayout);

    Label label = new Label(scaleGroup, SWT.NONE);
    label.setText(ResourceString.getResourceString("label.page.scale"));

    scaleSpinner = new Spinner(scaleGroup, SWT.BORDER);
    scaleSpinner.setIncrement(5);
    scaleSpinner.setMinimum(10);
    scaleSpinner.setMaximum(400);
    scaleSpinner.setSelection(100);

    label = new Label(scaleGroup, SWT.NONE);
    label.setText("%");

}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:29,代码来源:PageSettingDialog.java

示例11: setMarginSpinner

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private void setMarginSpinner(final Spinner spinner) {
    spinner.setDigits(1);
    spinner.setIncrement(5);
    spinner.setMinimum(0);
    spinner.setMaximum(1000);
    spinner.setSelection(20);
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:8,代码来源:PageSettingDialog.java

示例12: 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

示例13: initScaleGroup

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private void initScaleGroup(Composite parent) {
	GridData gridData = new GridData();
	gridData.grabExcessHorizontalSpace = true;
	gridData.horizontalAlignment = GridData.FILL;

	Group scaleGroup = new Group(parent, SWT.NONE);
	scaleGroup.setLayoutData(gridData);
	scaleGroup.setText(ResourceString
			.getResourceString("label.page.scale.printing"));

	GridLayout scaleGroupLayout = new GridLayout();
	scaleGroupLayout.marginWidth = 20;
	scaleGroupLayout.horizontalSpacing = 20;
	scaleGroupLayout.numColumns = 3;
	scaleGroup.setLayout(scaleGroupLayout);

	Label label = new Label(scaleGroup, SWT.NONE);
	label.setText(ResourceString.getResourceString("label.page.scale"));

	scaleSpinner = new Spinner(scaleGroup, SWT.BORDER);
	scaleSpinner.setIncrement(5);
	scaleSpinner.setMinimum(10);
	scaleSpinner.setMaximum(400);
	scaleSpinner.setSelection(100);

	label = new Label(scaleGroup, SWT.NONE);
	label.setText("%");

}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:30,代码来源:PageSettingDialog.java

示例14: setMarginSpinner

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
private void setMarginSpinner(Spinner spinner) {
	spinner.setDigits(1);
	spinner.setIncrement(5);
	spinner.setMinimum(0);
	spinner.setMaximum(1000);
	spinner.setSelection(20);
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:8,代码来源:PageSettingDialog.java

示例15: setSpinnerSelection

import org.eclipse.swt.widgets.Spinner; //导入方法依赖的package包/类
/**
 * Set the value of a spinner. For convenience this method takes an object as value, but if the obj is null, or if it
 * is not an Integer the method does nothing. If the displayed value is the same as the one provided, nothing is done
 * (preventing on windows the whole selection of the number).
 * 
 * @param spinner
 * @param obj
 */
public static void setSpinnerSelection(Spinner spinner, Object obj) {
	if (obj == null)
		return;
	if (!(obj instanceof Integer))
		return;
	int num = ((Integer) obj).intValue();
	if (spinner.getSelection() != num) {
		spinner.setSelection(num);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:UIUtil.java


注:本文中的org.eclipse.swt.widgets.Spinner.setSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。