How to set Tool Tip on the each Cell of JavaFX Table Mouse-Over?

Ashish Pancholi picture Ashish Pancholi · Nov 20, 2012 · Viewed 9.7k times · Source

I am new to JavaFX. I have created TableView and that looks like the image attached. I would like to show tool tip on each cell of the table when mouse over. I have already set two Cell Factory to rendering for displaying check-box and image in first and 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.

enter image description here

Answer

Interkot picture Interkot · Oct 9, 2014

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("Live is short, make most of it..!"));
          }
       };
    });