StackOverFlowError and Values equalling crazy numbers
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 t开发者_如何学Che 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
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.
精彩评论