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

[Glass, Mac] Cannot show two transparent stages at the same time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u20
    • 8
    • javafx
    • Macbook Air 2012, OS X 10.9, JavaFX 8b132 (8 initial release version).

      If I attempt to show two transparent stages, initially only the last stage which I show is shown.
      Once I close the last stage, the first stage is then shown.
      But both stages should be shown at the same time.

      Sample code:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;
      import javafx.stage.StageStyle;

      // should show (simultaneously) two transparent stages. Click on a stage to close it.
      public class DualTransparentStagesBug extends Application {
          @Override
          public void start(Stage stage1) {
              StackPane layout = createLayout("1");
              stage1.initStyle(StageStyle.TRANSPARENT);
              stage1.setScene(new Scene(layout, 100, 100, null));
              stage1.getScene().setOnMouseClicked(e -> stage1.hide());
              stage1.setX(200);
              stage1.setY(200);
              stage1.show();

              Stage stage2 = new Stage();
              stage2.initStyle(StageStyle.TRANSPARENT);
              stage2.setScene(new Scene(createLayout("2"), 100, 100, null));
              stage2.getScene().setOnMouseClicked(e -> stage2.hide());
              stage2.setX(350);
              stage2.setY(200);
              stage2.show();
          }

          private StackPane createLayout(String text) {
              StackPane layout = new StackPane(new Label(text));
              layout.setStyle("-fx-background-color: rgba(255, 255, 255, 0.3); -fx-font-size: 60;");
              return layout;
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

            anthony Anthony Petrov (Inactive)
            josmithjfx John Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: