【发布时间】:2017-01-29 10:21:11
【问题描述】:
有一种方法可以像这样设置工具提示
if (tooltipText != null) {
Label lb = new Label(column.getText());
lb.setTooltip(new Tooltip(tooltipText));
column.setText(null);
column.setGraphic(lb);
}
不幸的是会存在丑陋的副作用。
我们将 null 设置为列的文本,但 menuItems 调用 column.getText()。如果我们不这样做,header中就会出现双重名称。如何解决?假设通过 css..
这个答案不会消除副作用 How to add a tooltip to a TableView header cell in JavaFX 8
【问题讨论】: