Search code examples
javaswingjsliderjspinnersetvalue

How to check if value was set manually and not with setValue (JSlider, JSpinner)?


How can I check if the value of a JSlider or JSpinner was set via the graphical interface and not via the method setValue( int n) ?


Solution

  • Set a boolean value to true whenever you call setValue programmatically (before calling it), and reset it to false when you are done with the event handling.