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

[Stage] SetX, SetY works only after stage.show() but not before

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P5 P5
    • None
    • fx2.0
    • javafx
    • Build45, Win7, JDK6.26

      If you call setX or setY before stage.show() then it doesn't make any influence. If you call after then it make.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.Pane;
      import javafx.stage.Stage;

      public class Main extends Application {
          public void start(Stage stage) {
              TextField text = new TextField();

              Pane pane = new Pane();
              pane.getChildren().addAll(text);

              stage.setX(1500); // comment me. this call doesn't make effect
              stage.setScene(new Scene(pane));
              stage.show();
              stage.setX(1500); //or comment me. this call makes effect
          }

          public static void main(String[] args) {
              Application.launch(Main.class, args);
          }
      }

            kcr Kevin Rushforth
            akirov Alexander Kirov (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: