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

Dialog y position doesn't work properly

    XMLWordPrintable

Details

    Description

      ADDITIONAL SYSTEM INFORMATION :
      javafx 19-ea+3, openjdk version "14.0.2", Ubuntu 20.

      A DESCRIPTION OF THE PROBLEM :


      Please, consider the following code:

      public class JavaFxTest4 extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              Button button = new Button();
              button.setText("dialog");
              button.setOnAction((e) -> {
                  Dialog<?> d = new Dialog<>();
                  final Window window = d.getDialogPane().getScene().getWindow();
                  Stage stage = (Stage) window;
                  stage.setMinHeight(450);
                  stage.setMaxHeight(450);
                  stage.setHeight(450);
                  stage.setMinWidth(600);
                  stage.setMaxWidth(600);
                  stage.setWidth(600);
                  window.setY(300); //<---- note this line
                  window.setX(660); //<---- note this line
                  d.showAndWait();
              });

              VBox root = new VBox();
              root.getChildren().addAll(button);
              var scene = new Scene(root, 1920, 1000);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
      }

      As you can see window position is 660 (x) and 300 (y). And this is the result:
      First.png <attached>
      Second.png <attached>

      As you can see x position is correct, but y position is not. The problem was also discussed on SO - https://stackoverflow.com/questions/72583599/javafx-dialog-y-position-doesnt-work-properly


      Attachments

        1. Second.png
          Second.png
          34 kB
        2. JavaFxTest4.java
          1 kB
        3. First.png
          First.png
          25 kB
        4. Capture.PNG
          Capture.PNG
          108 kB

        Activity

          People

            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: