當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。