How do you add a ToolTip to a cell in a TableView?
TableColumn nameColumn = new TableColumn("Name");
nameColumn.setCellFactory((cell) -> {
return new TextFieldTableCell<Student, String>() {
@Override
public void updateItem(String string, boolean empty) {
super.updateItem(string, empty);
if (!empty) {
setTooltip(new Tooltip(getTableRow().getItem().getName()));
}
}
};
});
Enjoy!
Posted April 25th, 2024