Issue
Is there a way to get a column from a TableView by name?
When I need to get a column I have to get it by index:
tableView.getColumns().get(i);
but I would like to get the column by name:
tableView.getColumns().get("Column Name");
Solution
It's hard to envision a situation in which you couldn't just keep references to your columns, but you can always write a method like
private <T> TableColumn<T, ?> getTableColumnByName(TableView<T> tableView, String name) {
for (TableColumn<T, ?> col : tableView.getColumns())
if (col.getText().equals(name)) return col ;
return null ;
}
Answered By - James_D