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

GTK: Filechooser show method sometimes appears to block the JavaFX Application thread

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u20
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      Java 8u20 b17 on Linux

      Description

      In Linux if I show a FileChooser from one stage with Platform.runLater() it will appear to block the rendering of ui changes in all of my other stages. Oddly, if I don't use the runLater the other stages keep rendering properly.

      Run the test class below and follow these steps:

      1. Drag the 2 shown stages apart and click "Show Chooser..." on the first stage.

      2. Mouse over the controls on the second stage and observe them responding to the mouse hover.

      3. Close the open chooser.

      4. Turn on the "Run Later Chooser Show" on the first stage and then click on the "Show Chooser.." button again.

      5. Go back to the second stage and observe now that the controls do not respond to mouse hover. The button will respond to you click on it but it is no longer rendering its own updates. The checkbox will not render as selected until you close the chooser blocking the other dialog.

      ********************************************** Test Class ******************************************************
      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.CheckBox;
      import javafx.scene.control.Label;
      import javafx.scene.layout.Region;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.FileChooser;
      import javafx.stage.Stage;

      public class ProgressBarBug extends Application {

         private int stageNum_ = 0;
         
         @Override public void start(final Stage primaryStage) throws Exception {
            configureAndShowNewStage(primaryStage);
            configureAndShowNewStage(new Stage());
         }
         
         private void configureAndShowNewStage( Stage stage ) {
            stage.centerOnScreen();
            stage.setHeight(350);
            stage.setWidth(500);
            CheckBox checkbox = new CheckBox("Run Later Chooser Show");
            
            Button showModalButton = new Button("Show Chooser...");
            showModalButton.setOnAction(new EventHandler<ActionEvent>() {
               @Override public void handle(ActionEvent event) {
                  Runnable runner = new Runnable() {
                     @Override public void run() {
                        FileChooser chooser = new FileChooser();
                        chooser.showOpenDialog(stage);
                     }
                  };
                  if ( checkbox.isSelected() ) {
                     Platform.runLater(runner);
                  } else {
                     runner.run();
                  }
               }
            });
            
            VBox box = new VBox(30, new Label("Stage #"+ stageNum_),
                  checkbox, showModalButton );
            box.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
            box.setAlignment(Pos.TOP_CENTER);
            stageNum_++;

            stage.setScene( new Scene( new StackPane(box) ) );
            stage.show();
         }
         
         public static void main(String[] args) throws Exception {
            launch(args);
         }

      }

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            csmithjfx Charles Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Imported: