本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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));
}
示例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);
}
示例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);
}