3 Replies Latest reply on Nov 19, 2012 5:09 PM by jsmith

    JavaFX - Timers and application termination


      I need to do a job in the background with several seconds of delay after the user presses a key (a delayed search to be more precise). To do this, I use a java.util.Timer, but since including it the application does not exit correctly after the last window is closed.

      To reduce the problem to the minimum expression, I've created this applicacion that shows the problem (eclipse shows it is still running after pressing close button):

      public class ApplicationClosing extends Application {

           private final Timer timerFiltro = new Timer();

           public static void main(final String[] args) {

           public void start(final Stage primaryStage) {
                Group root = new Group();
                Scene scene = new Scene(root, 400, 250, Color.WHITE);
                BorderPane borderPane = new BorderPane();
                borderPane.setCenter(new Label("Hello"));

      If a comment the line of the Timer, the application ends correctly. Any ideas?

      Thank you all for your help :)