Does anyone know how to add a tooltip to a column header in a TableView ?
There are many places where are explained how to add the tooltip to data cells, but I didn\'t f
This is an extended answer to James_D. (I don't have the reputation to comment):
To make the label connect with textProperty of the column and just hide the original text, so it does not mess up the rest of the table functionality:
nameLabel.textProperty().bindBidirectional(textProperty());
nameLabel.getStyleClass().add("column-header-label");
nameLabel.setMaxWidth(Double.MAX_VALUE); //Makes it take up the full width of the table column header and tooltip is shown more easily.
css:
.table-view .column-header .label{
-fx-content-display: graphic-only;
}
.table-view .column-header .label .column-header-label{
-fx-content-display: text-only;
}