Description
See community discussion https://community.oracle.com/message/12383076
Using id in lookup on table should find the TableColumn. I dumped out the node structure of the table and the TableColumn didn't have the id.
@Override
public void start(Stage stage) {
TableColumn<Fruit, String> fruitNameCol = new TableColumn<>(
"Fruit"
);
fruitNameCol.setCellValueFactory(
new PropertyValueFactory<>(
"name"
)
);
fruitNameCol.setId("column-not-found");
TableView<Fruit> table = new TableView<>(
FXCollections.<Fruit>observableArrayList(
new Fruit("apple"),
new Fruit("orange")
)
);
table.getColumns().setAll(
fruitNameCol
);
stage.setScene(
new Scene(
table, 50, 100
)
);
stage.show();
System.out.println("Found column => " + table.lookup("column-not-found"));
}
public class Fruit {
private String name;
public Fruit(String name) { this.name = name; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
Using id in lookup on table should find the TableColumn. I dumped out the node structure of the table and the TableColumn didn't have the id.
@Override
public void start(Stage stage) {
TableColumn<Fruit, String> fruitNameCol = new TableColumn<>(
"Fruit"
);
fruitNameCol.setCellValueFactory(
new PropertyValueFactory<>(
"name"
)
);
fruitNameCol.setId("column-not-found");
TableView<Fruit> table = new TableView<>(
FXCollections.<Fruit>observableArrayList(
new Fruit("apple"),
new Fruit("orange")
)
);
table.getColumns().setAll(
fruitNameCol
);
stage.setScene(
new Scene(
table, 50, 100
)
);
stage.show();
System.out.println("Found column => " + table.lookup("column-not-found"));
}
public class Fruit {
private String name;
public Fruit(String name) { this.name = name; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
Attachments
Issue Links
- duplicates
-
JDK-8096688 FXML TableColumn only gets an id if the enclosing TableView has one, and it's set with "id" instead of "fx:id"
- Resolved