本文整理匯總了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);
}