JSpinner get Max Min Value

心不动则不痛 提交于 2019-12-11 14:25:46

问题


I can get the current value by using getValue(), but is it possible to get the Maximum and Minimum allowable value for the JSpinner? Can't find method such as getMax() or getMin() for JSpinner from the docs.

http://docs.oracle.com/javase/7/docs/api/javax/swing/JSpinner.html

http://docs.oracle.com/javase/7/docs/api/javax/swing/SpinnerModel.html


回答1:


Only some SpinnerModel's have the concept of min/max values.

So you need to look at the specific model you are using for your spinner. For example,

  1. SpinnerNumberModel
  2. SpinnerDateModel


来源:https://stackoverflow.com/questions/20226702/jspinner-get-max-min-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!