【发布时间】:2013-05-15 12:11:54
【问题描述】:
当我的JSpinner 为空时,我想取空值。但是当我调用getValue() 函数时,它会返回0.0。
public JFormattedTextField getTextField(JSpinner spinner) {
JComponent editor = spinner.getEditor();
if (editor instanceof JSpinner.DefaultEditor) {
return ((JSpinner.DefaultEditor)editor).getTextField();
} else {
return null;
}
}
这是我的方法调用:
Object a = getTextField(jValueNum).getValue();
编辑:或者有什么办法可以超载 getValue() 函数?
【问题讨论】:
标签: java swing isnull jspinner jformattedtextfield