Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要表示 JSpinner 的值不为空的情况。以下语句似乎无法正常工作:
if (!timeSpinner.getValue().equals(null)) { ...}
从文档看来SpinnerNumberModel,SpinnerDateModel您通常不允许将其null作为一个值。构造模型时抛出异常,设置新值时,如果该值是null.
SpinnerNumberModel
SpinnerDateModel
null
您可以创建自己的SpinnerModel并自己处理条件。
SpinnerModel