The following code works
TableView<String> v = new TableView<String>();
Scene sx = new Scene(v, 300, 300);
stage.setScene(sx);
TableColumn<String> col = new TableColumn<String>();
col.setText("XXXXX");
v.getColumns().add(col);
TableColumn<String> col1 = new TableColumn<String>();
col1.setText("AAAA");
col.getColumns().add(col1);
TableColumn<String> col2 = new TableColumn<String>();
col2.setText("BBBB");
col.getColumns().add(col2);
stage.setVisible(true);
But the following code (which is the same code with the stage.setVisible() call moved), does not
TableView<String> v = new TableView<String>();
Scene sx = new Scene(v, 300, 300);
stage.setScene(sx);
stage.setVisible(true);
TableColumn<String> col = new TableColumn<String>();
col.setText("XXXXX");
v.getColumns().add(col);
TableColumn<String> col1 = new TableColumn<String>();
col1.setText("AAAA");
col.getColumns().add(col1);
TableColumn<String> col2 = new TableColumn<String>();
col2.setText("BBBB");
col.getColumns().add(col2);
TableView<String> v = new TableView<String>();
Scene sx = new Scene(v, 300, 300);
stage.setScene(sx);
TableColumn<String> col = new TableColumn<String>();
col.setText("XXXXX");
v.getColumns().add(col);
TableColumn<String> col1 = new TableColumn<String>();
col1.setText("AAAA");
col.getColumns().add(col1);
TableColumn<String> col2 = new TableColumn<String>();
col2.setText("BBBB");
col.getColumns().add(col2);
stage.setVisible(true);
But the following code (which is the same code with the stage.setVisible() call moved), does not
TableView<String> v = new TableView<String>();
Scene sx = new Scene(v, 300, 300);
stage.setScene(sx);
stage.setVisible(true);
TableColumn<String> col = new TableColumn<String>();
col.setText("XXXXX");
v.getColumns().add(col);
TableColumn<String> col1 = new TableColumn<String>();
col1.setText("AAAA");
col.getColumns().add(col1);
TableColumn<String> col2 = new TableColumn<String>();
col2.setText("BBBB");
col.getColumns().add(col2);