I am puzzled by the following occurence within the basic javafx application start method: Why does the Button btn not appear on stage (when .show() is called) but only when the for loop has ended?
public class JavaFXApplication extends Application {
@Override
public void start(Stage stage) {
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction((ActionEvent ae) -> {
System.out.println("Hello World!");
});
StackPane root = new StackPane();
root.getChildren().add(btn);
Scene scene = new Scene(root, 300, 250);
stage.setTitle("Hello World!");
stage.setScene(scene);
stage.show();
for (int i = 0; i < 99999; i++) {
System.out.println("Hello World # " + i);
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}