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


Java SpinnerNumberModel.setValue方法代码示例

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


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

示例1: changeZoom

import javax.swing.SpinnerNumberModel; //导入方法依赖的package包/类
/**
 * Changes the zoom level
 * @param delta How much to change the current level (can be negative or
 * positive)
 */
public void changeZoom(int delta) {	
	SpinnerNumberModel model = 
		(SpinnerNumberModel)this.zoomSelector.getModel();
	double curZoom = model.getNumber().doubleValue();
	Number newValue = new Double(curZoom + model.getStepSize().
			doubleValue() * delta * curZoom * 100); 
	
	if (newValue.doubleValue() < ZOOM_MIN) {
		newValue = ZOOM_MIN;
	} else if (newValue.doubleValue() > ZOOM_MAX) {
		newValue = ZOOM_MAX;
	}

	model.setValue(newValue);
	this.updateZoomScale(true);
}
 
开发者ID:mdonnyk,项目名称:the-one-mdonnyk,代码行数:22,代码来源:GUIControls.java

示例2: IUGestionarTipoImpuestoEmpresaTipoImpuesto

import javax.swing.SpinnerNumberModel; //导入方法依赖的package包/类
public IUGestionarTipoImpuestoEmpresaTipoImpuesto(String cuitEmpresa) {
    initComponents();
    this.setLocationRelativeTo(null);
    DTOEmpresa dtoEmpresa = controlador.buscarEmpresa(cuitEmpresa);
    TextField_Cuit.setText(cuitEmpresa);
    TextField_Nombre.setText(dtoEmpresa.getNombreEmpresa());
      
    
    SpinnerNumberModel sf = new SpinnerNumberModel();
    sf.setMinimum(0);
    sf.setValue(0);
    spinner_Frecuencia.setModel(sf);
    
    
    //TextField_frec.setText(dtoEe.);
    List<DTOTipoEmpresa> listTipoEmpresa = controlador.buscarTipoEmpresa();
    llenarComboTipoEmpresa(listTipoEmpresa);
    List<DTOTipoImpuesto> listTipoImpuesto = controlador.buscarTipoImpuesto();
    llenarComboTipoImpuesto(listTipoImpuesto);

}
 
开发者ID:turing2017,项目名称:Dise-o-2017,代码行数:22,代码来源:IUGestionarTipoImpuestoEmpresaTipoImpuesto.java

示例3: update

import javax.swing.SpinnerNumberModel; //导入方法依赖的package包/类
/**
 * Update this panel.
 *
 * @param dt The {@code DiplomaticTrade} to update with.
 */
public void update(DiplomaticTrade dt) {
    int gold = dt.getGoldGivenBy(source);
    if (gold >= 0) {
        SpinnerNumberModel model
                = (SpinnerNumberModel)spinner.getModel();
        model.setValue(gold);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:14,代码来源:NegotiationDialog.java

示例4: bug6463712

import javax.swing.SpinnerNumberModel; //导入方法依赖的package包/类
public bug6463712() {
    SpinnerNumberModel m1 = new SpinnerNumberModel();
    JSpinner s = new JSpinner(m1);
    s.addChangeListener(this);
    SpinnerDateModel m2 = new SpinnerDateModel();
    s.setModel(m2);

    // m1 is no longer linked to the JSpinner (it has been replaced by m2), so
    // the following should not trigger a call to our stateChanged() method...
    m1.setValue(new Integer(1));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:bug6463712.java

示例5: IUGestionarTipoImpuestoModificacionItem

import javax.swing.SpinnerNumberModel; //导入方法依赖的package包/类
public IUGestionarTipoImpuestoModificacionItem(String nombreItem, String cuitEmpresa, int codigoTipoImpuesto,String nombreTipoEmpresa, int ordenItem) {
    initComponents();
    this.setLocationRelativeTo(null);
    this.nombreTipoEmpresa = nombreTipoEmpresa;
    this.codigoTipoImpuesto = codigoTipoImpuesto;
    this.cuitEmpresa = cuitEmpresa;
    this.ordenAnterior = ordenItem;
    jTextField_ItemNombre.setText(nombreItem);
    SpinnerNumberModel sf = new SpinnerNumberModel();
    sf.setMinimum(0);
    sf.setValue(ordenItem);
    spinner_Orden.setModel(sf);
}
 
开发者ID:turing2017,项目名称:Dise-o-2017,代码行数:14,代码来源:IUGestionarTipoImpuestoModificacionItem.java

示例6: EditSettlementDialog

import javax.swing.SpinnerNumberModel; //导入方法依赖的package包/类
/**
 * Create an EditSettlementDialog.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param is The {@code IndianSettlement} to edit.
 */
public EditSettlementDialog(FreeColClient freeColClient, JFrame frame,
                            final IndianSettlement is) {
    super(freeColClient, frame);

    this.is = is;

    this.name = new JTextField(is.getName(), 30);

    DefaultComboBoxModel<Nation> nationModel
        = new DefaultComboBoxModel<>();
    for (Nation n : getSpecification().getIndianNations()) {
        nationModel.addElement(n);
    }
    this.owner = new JComboBox<>(nationModel);
    this.owner.setSelectedItem(is.getOwner().getNation());
    this.owner.addItemListener(this);
    this.owner.setRenderer(new FreeColComboBoxRenderer<Nation>());

    this.capital = new JCheckBox();
    this.capital.setSelected(is.isCapital());

    this.skill = new JComboBox<>(getSkillModel());
    this.skill.setSelectedItem(is.getLearnableSkill());
    this.skill.setRenderer(new FreeColComboBoxRenderer<UnitType>());

    int unitCount = is.getUnitCount();
    SpinnerNumberModel spinnerModel
        = new SpinnerNumberModel(unitCount, 1, 20, 1);
    this.units = new JSpinner(spinnerModel);
    spinnerModel.setValue(unitCount);

    MigPanel panel = new MigPanel(new MigLayout("wrap 2, gapx 20"));
    panel.add(Utility.localizedLabel("name"));
    panel.add(this.name);
    panel.add(Utility.localizedLabel("nation"));
    panel.add(this.owner);
    panel.add(Utility.localizedLabel("capital"));
    panel.add(this.capital);
    panel.add(Utility.localizedLabel("skillTaught"));
    panel.add(this.skill);
    panel.add(Utility.localizedLabel("units"));
    panel.add(this.units);

    final IndianSettlement fake = null;
    List<ChoiceItem<IndianSettlement>> c = choices();
    c.add(new ChoiceItem<>(Messages.message("ok"), is).okOption());
    c.add(new ChoiceItem<>(Messages.message("editSettlementDialog.removeSettlement"), fake));
    c.add(new ChoiceItem<>(Messages.message("cancel"), fake)
        .cancelOption().defaultOption());
    initializeDialog(frame, DialogType.QUESTION, true, panel, new ImageIcon(
        getImageLibrary().getSmallSettlementImage(is)), c);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:60,代码来源:EditSettlementDialog.java


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