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);
}
}
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);
}
}
- relates to
-
JDK-8088011 Gtk: stage.setX doesn't work if called before stage.show
- Open