StackOverFlowError 和等于疯狂数字的值
我有这样的代码:
Integer it = (Integer)(strengthSpinner.getValue());
旋转器的值等于:
SpinnerModel one = new SpinnerNumberModel(10, 10, 99, 1);
每次将源作为 JSpinner 返回时,都会有一个 pointsRemaining--;执行。
如果我在内部值被弄乱之后得到 Spinner 的值,第一个整数它 = 是值更改之前的值还是与执行后的值相同?
目前,我在微调器之前和之后收到一个带有 getValue() 的堆栈溢出错误,并且我的值等于 987 或某个疯狂的数字。
我需要将微调器过去的值与新值进行比较,并根据发生的变化影响剩余点数
I have this code:
Integer it = (Integer)(strengthSpinner.getValue());
The value of the spinner there is equal to:
SpinnerModel one = new SpinnerNumberModel(10, 10, 99, 1);
Every time the source is returned as the JSpinner a pointsRemaining--; executes.
If I get the value of the Spinner AFTER the value inside has been messed with will the first Integer it = be the value before the value changed or will it be the same as the value after it executes?
Currently I am getting a stackoverflowerror with a getValue() before and after the spinner and my values are equaling 987 or some crazy number.
I need to compare the past value that spinner had, to the new value and depending on what change happened, that affects the pointsRemaining
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否通过设置相同的 JSpinner 值来响应 JSpinner 值的更改?这几乎肯定会导致堆栈溢出。
Are you responding to a change in the JSpinner value by setting the same JSpinner's value? That will all but guarantee a stack overflow.