Whenever I print the label size in the following code I get 0.0 as the width when it's somewhere around 290.
private void initializeComponents() {
setId("main_window");
setAlignment(Pos.TOP_LEFT);
String sn = "scene_main.css";
String stylesheet = getClass().getResource(sn).toExternalForm();
getStylesheets().add(stylesheet);
welcome.setTranslateX((Main.window.getWidth() - welcome.getWidth()) / 2);
welcome.setTranslateY(5);
options.setTranslateX((Main.window.getWidth() - options.getWidth()) / 2);
options.setTranslateY(welcome.getTranslateY() + welcome.getHeight() + 20);
getChildren().add(welcome);
getChildren().add(options);
}
private Label welcome = new Label("Welcome to your Bank!");
private Label options = new Label("Choose a user.");
This code is called AFTER the stage is shown. What can I do to update the width of the labels?