I have an object in Java whose state changes over time. When one of the fields of an object reaches a certain value, I want an external event to be triggered.
I know that Swing processes this template through Listeners - and I use Swing for this project, but I'm not sure what the listener would apply to this case. The user state is not changed by the user, and listeners seem to be triggered only by user actions.
Change The object that I control is not itself a Swing component - it works in the background in the main thread.
source share