problem with fireStateChanged() method for JSpinner
I have a problem invoking the fireStateChanged() method for a JSpinner. I create a JSpinner and when I try to invoke fireStateChanged() method for that spinner someSpinner.fireStateCh开发者_JAVA百科anged();
, eclipse shows me this error:
The method fireStateChanged() from the type JSpinner is not visible
Does anyone have any idea on how to correctly invoke fireStateChanged() method for a JSpinner in my case?
Thanx =)
You get this error because the method is protected. This means the method can only be called from within the JSpinner class or a subclass (or a class in the same package). It's not supposed to be called from the outside.
The spinner is responsible for firing a state changed event each time a change to its model occurs. Change the value of the spinner, either through the UI or by calling the setValue method, and a state changed event will automatically be fired by the spinner.
精彩评论