When the application is opened the user is faced with a log in screen, I need to know how to create a 5 minute timer when the scene is the log in screen and if no user has logged in after 5 mins, exit the application.
Timer timer = new Timer();
TimerTask task = new TimerTask() {
public void run() {
System.exit(0);
}
};
while (model.getUsername().equals("")) { //while user is not logged in
timer.schedule(task, 1000 * 60 * 5);
}
timer.cancel();
I have created the code above but unsure why it would fit in the MVC approach to ensure everytime the user enters the log in scene, the timer starts.