I\'m currently working with two controller classes.
In Controller1 it creates a new stage that opens on top of the main one.
Stage stage = new Stage
Doing it your way, this would work:
long mTime = System.currentTimeMillis();
long end = mTime + 5000; // 5 seconds
while (mTime < end)
{
mTime = System.currentTimeMilis();
}
stage.close();
You need to save your stage into a variable. Maybe it is better to run that in a Thread, so that you can do something within the 5 seconds. Another way would be to run a Thread.sleep(5000); and this would also be more performant than the while loop.