Message/Confirm box with timeout option

Is it possible to create a confirmation box that has a timeout option? After a few seconds if there is no action it would default to one of the available options.

I have played around using JOptionPane; however, I am not sure how to go about incorporating a timer.

I’m not aware of a way to do this with the confirmation box (but maybe someone smarter than me does!). Your best bet might be to create a custom popup window. You can then use the timer component or other scripting functions to get the desired functionality.

When the popup is opened, you can use system.util.invokeAsynchronous to call a function that waits a certain amount of time before sending a message. Then you can set up a message handler on one of your components that automatically chooses an option if one hasn’t already been chosen.
Here is an example of what the code that calls invokeAsynchronous might look like:

	def waitThenSendMessage():
		import time
		system.perspective.sendMessage('msg', {}, 'session',

The OP didn’t specify, but the fact they mention the JOptionPane identifies they’re using Vision.

I created my own confirm popup window to which I can pass two functions, an on yes and and on no function so that I can do whatever I want when the user clicks either button.