I'm working on a Java project involving user interface, using the Button class and some action listeners. I have a few buttons (each with an action listener) and I want to add a timeout to the whole program. That means, if no button was clicked-on in a certain amount of time, a specific action should be performed.
I tried adding it among the basic while loop + isDisposed() function. To my knowledge, this loop checks multiple times whether a button was clicked-on. For some reason, I couldn't get the outcome I wanted. Is there a way to do so with the classes I mentioned? I also couldn't find any suitable functions in the Button class.