How to set Tool Tip on the each Cell of JavaFX Table Mouse-Over?
cell, java, javafx-2, render, tooltip
Solution
Here is what I did when I needed a tool tip in the cells of a certain column:
TableColumn<Person, String> nameCol = new TableColumn<Person, String>("Name");
nameCol.setCellFactory
(
column ->
{
return new TableCell<Person, String>()
{
@Override
protected void updateItem(String item, boolean empty)
{
super.updateItem(item, empty);
setText( item );
setTooltip(new Tooltip("Life is short, make most of it..!"));
}
};
});
Problem
I am new to JavaFX. I have created a `TableView` that looks like the image attached. I would like to show a tool tip on each cell of the table when I mouse over. I have already set two `CellFactory`; one to display a check-box in the first column and one to display an image in the second column. So showing Tool Tip must not affect these two rendered columns. Is there any way to show tool tip on each cell of the table on mouse over and that should not affect other individual column cell rendering.