簡體   English   中英

如何為表列添加工具提示?

[英]How to add tooltip for table column?

如何為表列或行添加工具提示?

UPD:

我有一張桌子。 我想為單元格(列)添加工具提示或為文本字段添加行 例

就我而言:

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);
               }
            }
         };
      }});

可以通過調用setToolTip方法設置工具提示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM