1 package be
.nikiroo
.utils
.ui
;
3 import javax
.swing
.JComponent
;
4 import javax
.swing
.JSpinner
;
6 import be
.nikiroo
.utils
.resources
.MetaInfo
;
8 class ConfigItemInteger
<E
extends Enum
<E
>> extends ConfigItem
<E
> {
9 private static final long serialVersionUID
= 1L;
12 * Create a new {@link ConfigItemInteger} for the given {@link MetaInfo}.
15 * the {@link MetaInfo}
17 public ConfigItemInteger(MetaInfo
<E
> info
) {
22 protected Object
getFromField(int item
) {
23 JSpinner field
= (JSpinner
) getField(item
);
25 return field
.getValue();
32 protected Object
getFromInfo(int item
) {
33 return getInfo().getInteger(item
, true);
37 protected void setToField(Object value
, int item
) {
38 JSpinner field
= (JSpinner
) getField(item
);
40 field
.setValue(value
== null ?
0 : (Integer
) value
);
45 protected void setToInfo(Object value
, int item
) {
46 getInfo().setInteger((Integer
) value
, item
);
50 protected JComponent
createEmptyField(int item
) {
51 return new JSpinner();