0

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

Nick Gibson
  • 155
  • 1
  • 3
  • 10
  • 1
    You need to be clear about what's going on in your code for us to help you. Your explanation is murky at best. Post an example that demonstrates the problem. What is `pointsRemaining`? When, where and why are you decrementing it? What is the first part of the `StackOverflowError` backtrace? – Mark Peters Jun 22 '10 at 16:58

1 Answers1

0

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.

Curtis
  • 3,931
  • 1
  • 19
  • 26