A JavaFX applet is loaded and running a thread which populates various UI elements
every 3 seconds Suddenly the user who is viewing the applet decides to open his outlook email
or some other application. At this time, the applet would still be running and updating the UI elements.
function when the user moves out of the tab where the JavaFX applet is currently loaded.
How can I do this?
That's something extremely hard, or even impossible to do, at least in a cross-browser way. Unless I am proven otherwise... :-)
But I digress, that's not what you asked for.
Come to think of it, a possible way to explore is to use onBlur, ie. to check if the page (or the applet, perhaps) lost the focus. Not sure if that's reliable, might happen, eg., if the user just go to the browser's menu.
subject: How to stop a thread when the user moves away from the JavaFX applet