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

[Linux] APPLICATION_MODAL Stage displays additional Taskbar Icon

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u45
    • javafx
    • Linux

      When running the attached SSCCE with Java 8u45 we get an additional taskbar entry for the new window (screenshot -> http://i.imgur.com/0G4JRhs.png).

      When we run the same example with Java 7 we don't get this additonal taskbar entry (screenshot -> http://i.imgur.com/frjivcT.png).

      We don't get the additonal taskbar entry in Windows regardless of the Java version.

      We expect that additional APPLICATION_MODAL stage windows behave the same across all operating systems with regard to the display of taskbar icons.

      Example code:

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.geometry.Insets;
      import javafx.geometry.Pos;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.HBox;
      import javafx.scene.paint.Color;
      import javafx.stage.Modality;
      import javafx.stage.Stage;
      import javafx.stage.StageStyle;
      import javafx.stage.Window;

      public class Main extends Application {

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

          @Override
          public void start(final Stage primaryStage) throws Exception {
              Button openDialogBtn = new Button("Open dialog");
              openDialogBtn.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(final ActionEvent event) {
                      openDialog(primaryStage);
                  }
              });

              HBox root = createRoot(Pos.CENTER, openDialogBtn);

              primaryStage.setScene(new Scene(root, 300, 50, Color.BLUE));
              primaryStage.setTitle("Stage Examples");
              primaryStage.show();
          }

          private HBox createRoot(final Pos pos, final Node... nodes) {
              HBox root = new HBox(10);
              root.getChildren().addAll(nodes);
              root.setPadding(new Insets(10));
              root.setAlignment(pos);
              return root;
          }

          private void openDialog(final Window owner) {
              final Stage stage = new Stage(StageStyle.TRANSPARENT);
              Button close = new Button("Close dialog");
              close.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(final ActionEvent event) {
                      stage.close();
                  }
              });

              HBox root = createRoot(Pos.BOTTOM_CENTER, close);
              root.setStyle("-fx-border-width: 2px; -fx-border-color: #f00");

              stage.setScene(new Scene(root, 200, 200, Color.TRANSPARENT));
              stage.initOwner(owner);
              stage.initModality(Modality.APPLICATION_MODAL);
              stage.show();
          }
      }

      Thanks!

            Unassigned Unassigned
            jhohmuthjfx Jens Hohmuth (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported: