Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152391

FileChooser doesn't close instantly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P5 P5
    • tbd
    • 8u72
    • javafx

      FULL PRODUCT VERSION :
      java version "1.8.0_72"
      Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 3.19.0-32-generic #37~14.04.1-Ubuntu SMP
      x86_64 x86_64 GNU/Linux

      (LinuxMint)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Intel Pentium 2,30GHz,
      DDR2 RAM,
      Intel HD Graphics

      A DESCRIPTION OF THE PROBLEM :
      If your'e having a while loop with break conditions placed directly after a FileChooser.openDialog Method in the main thread of Java FX, the FileChooser will close as recently as the while-loop has ended. Under Windows, with the same steps, the file chooser closes directly after file choosing(while loops was still running!).


      (I know, its not well programming style to use a while loop in the javafx main thread!)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      First, create a class which extends from Application. Implements all methods, which are needed to launch the application.

      Next, place a FileChooser in the start method and use it to save and or load a File (FileChooser.showOpenDialog method meant). Place directly after this method a whileLoop with break conditions.

      Finally, run the programm!

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      If you selected a File the filechooser will close as recently as the while loop has ended and not as recently as you have choosen a file.
      ACTUAL -
      On windows I have no problem, under Linux the file chooser closes after the while loop has finished.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error messages.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public void start(Stage primaryStage){
                      FileChooser chooser=new FileChooser();
      chooser.showOpenDialog(new Stage());
      //Doing something big, which takes time
                      int i=10000;
      while(i>0){
      i--;
                      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      You can solve this temporary if you're using the Method YourePrefferedStageNameForTheFileChooser.show() after the openDialog Method and before the while-loop. If done like that, the file chooser will close regardless of wheter there's the while loop or not.

      SUPPORT :
      YES

            ddhill David Hill (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: