How to add tooltip for table column?


Question

How to add tooltip for table column or row?

UPD:

I have a table. And I want to add tooltip for cell (column) or row like for textfield example

1
4
9/26/2012 4:32:52 AM

Accepted Answer

The tooltip can be set by calling setToolTip method.

1
9/26/2012 5:24:29 AM

In my case:

mycolumn.setCellFactory(
   new Callback<TableColumn<MyModel, String>, TableCell<MyModel, String>>() {
      @Override
      public TableCell<MyModel,String> call(TableColumn<MyModel,String> tableColumn){
         return new TextFieldTableCell<MyModel, String>() {
            @Override public void updateItem(String string, boolean isEmpty) {
               super.updateItem(string, isEmpty);
               if (!isEmpty) {
                  MyModel model =
                     getTableView().getItems().get(getTableRow().getIndex());
                  Tooltip tip = new Tooltip(model.getTip());
                  setTooltip(tip);
               }
            }
         };
      }});

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon