• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SpinnerModel类的典型用法代码示例

java 10次浏览

本文整理汇总了Java中javax.swing.SpinnerModel的典型用法代码示例。如果您正苦于以下问题:Java SpinnerModel类的具体用法?Java SpinnerModel怎么用?Java SpinnerModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SpinnerModel类属于javax.swing包,在下文中一共展示了SpinnerModel类的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createDateSpinner

点赞 3

import javax.swing.SpinnerModel; //导入依赖的package包/类
static void createDateSpinner() {
    Calendar calendar = Calendar.getInstance();
    Date initDate = calendar.getTime();
    calendar.add(Calendar.YEAR, -1);
    Date earliestDate = calendar.getTime();
    calendar.add(Calendar.YEAR, 1);
    Date latestDate = calendar.getTime();
    SpinnerModel dateModel = new SpinnerDateModel(initDate,
            earliestDate,
            latestDate,
            Calendar.YEAR);
    spinner = new JSpinner();
    spinner.setModel(dateModel);
}
 

开发者ID:AdoptOpenJDK,
项目名称:openjdk-jdk10,
代码行数:15,
代码来源:bug8008657.java

示例2: BackupView

点赞 3

import javax.swing.SpinnerModel; //导入依赖的package包/类
public BackupView() {
	setLayout( new BorderLayout() );
	add( new FormPanel( "backups.jfrm" ), BorderLayout.CENTER );
	
	SpinnerModel model = new SpinnerNumberModel(30, 1, 120, 1 );
	getSpinner(ID_BACKUP_PERIOD).setModel(model);
	

	setController( new BackupViewController(this) );
	setUIDirector( new BackupViewUIDirector() );
	
	model.setValue( AppProperties.getIntProperty( ID_BACKUP_PERIOD, 30 ) );
	setText(ID_BACKUP_LOCATION, AppProperties.getProperty( ID_BACKUP_LOCATION));
	setSelected( ID_AUTOMATIC_BACKUPS, "true".equals(AppProperties.getProperty( ID_AUTOMATIC_BACKUPS)));
	setVisible(ID_BACKUP_MESSAGE, false );
	updateComponents(null);
}
 

开发者ID:jeff-tassin,
项目名称:jeffslocker,
代码行数:18,
代码来源:BackupView.java

示例3: createSpinner

点赞 3

import javax.swing.SpinnerModel; //导入依赖的package包/类
/**
* Helper method to create a JSpinner.
* 
* @param range the range of the spinner
* @param dtype data type. One of the DTYPE_XXX constants defined in
* com.korilog.kform.core.Item.
*/
  private JSpinner createSpinner(Range range, int dtype){
      JSpinner     spin;
      SpinnerModel model;
      
      if (dtype==Item.DTYPE_INT){
          model = new SpinnerNumberModel(
                  ((IntRange)range).getRangeDef(),
                  ((IntRange)range).getRangeFrom(),
                  ((IntRange)range).getRangeTo(),
                  1);
      }
      else{
          model = new SpinnerNumberModel(
                  ((DoubleRange)range).getRangeDef(),
                  ((DoubleRange)range).getRangeFrom(),
                  ((DoubleRange)range).getRangeTo(),
                  1);
      }
      spin= new JSpinner(model);
      
      return spin;
  }
 

开发者ID:pgdurand,
项目名称:jGAF,
代码行数:30,
代码来源:PropertiesPanel.java

示例4: createWidthPanel

点赞 3

import javax.swing.SpinnerModel; //导入依赖的package包/类
/**
 * This method creates and return the panel of the width. It used for the
 * stroke elements and contains the unit panel.
 * 
 * @param width
 *            the width of the stroke of the style to be modified.
 * @param unit
 *            the unit of the style to be modified.
 * @return the panel of the width.
 */
public JPanel createWidthPanel(double width, String unit) {
    JLabel lblWidth = new JLabel(I18N.getString("StyleEditionFrame.Width")); //$NON-NLS-1$

    SpinnerModel model = new SpinnerNumberModel(width, // initial value
            0d, // min
            1000d, // max
            0.5d);
    JSpinner spinner = new JSpinner(model);
    spinner.addChangeListener(this);

    JPanel widthPanel = new JPanel();
    widthPanel.add(lblWidth);
    widthPanel.add(spinner);
    widthPanel.add(this.createUnitPanel(unit));
    return widthPanel;
}
 

开发者ID:IGNF,
项目名称:geoxygene,
代码行数:27,
代码来源:StyleEditionFrame.java

示例5: createSizePanel

点赞 3

import javax.swing.SpinnerModel; //导入依赖的package包/类
/**
 * This method creates and return the panel of the size of a point symbol.
 * 
 * @param size
 *            the size of the style to be modified.
 * @return the panel of the size of a point symbol.
 */
public JPanel createSizePanel(float size) {
    JLabel lblSize = new JLabel(I18N.getString("StyleEditionFrame.Size")); //$NON-NLS-1$

    SpinnerModel model = new SpinnerNumberModel(size, // initial value
            0f, // min
            1000f, // max
            0.5f);
    JSpinner spinner = new JSpinner(model);
    spinner.addChangeListener(this);

    JPanel sizePanel = new JPanel();
    sizePanel.add(lblSize);
    sizePanel.add(spinner);

    return sizePanel;
}
 

开发者ID:IGNF,
项目名称:geoxygene,
代码行数:24,
代码来源:StyleEditionFrame.java

示例6: NumberParamValuePanel

点赞 3

import javax.swing.SpinnerModel; //导入依赖的package包/类
public NumberParamValuePanel(Parameter parameter) {
	super();
	final String type = parameter.getValue().getType();
	final Parameter curParam = parameter;
	SpinnerModel model = new SpinnerNumberModel(1, 0, 100, 1);
	JSpinner spinner = new JSpinner(model);
	mParaValueBox = spinner;

	parameter.setValue(type, Integer.toString(0));

	mParaValueBox.addChangeListener(new ChangeListener() {

		@Override
		public void stateChanged(ChangeEvent e) {
			//System.out.println("Setting value of parameter to: " + mParaValueBox.getModel().getValue());
			curParam.setValue(type, Integer.toString((Integer) mParaValueBox.getModel().getValue()));

		}
	});

	this.add(mParaValueBox);
}
 

开发者ID:iig-uni-freiburg,
项目名称:SWAT20,
代码行数:23,
代码来源:NumberParamValuePanel.java

示例7: getBlackThresholdModel

点赞 3

import javax.swing.SpinnerModel; //导入依赖的package包/类
public static SpinnerModel getBlackThresholdModel(Scanner scanner) {
  SpinnerNumberModel blackThresholdModel = new SpinnerNumberModel(0, MIN_BLACK_THRESHOLD,
      MAX_BLACK_THRESHOLD, 1);

  HashMap<String, FixedOption> fixedOptions = scanner.getFixedOptions();

  FixedOption fixedOption = fixedOptions.get(SANE_NAME_THRESHOLD);

  if (fixedOption == null) {
    return null;
  }

  Constraints constraints = fixedOption.getConstraints();
  Integer maxInt = constraints.getMaximumInteger();
  Integer minInt = constraints.getMinimumInteger();

  blackThresholdModel.setMaximum(maxInt);
  blackThresholdModel.setMinimum(minInt);
  blackThresholdModel.setStepSize(constraints.getQuantumInteger());

  blackThresholdModel.setValue(fixedOption.getValue());

  return blackThresholdModel;
}
 

开发者ID:rquast,
项目名称:swingsane,
代码行数:25,
代码来源:KnownSaneOptions.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)