如何在JavaFX 8中向TableView标题单元格添加工具提示 [英] How to add a tooltip to a TableView header cell in JavaFX 8
本文介绍了如何在JavaFX 8中向TableView标题单元格添加工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有人知道如何将工具提示添加到 TableView ?
Does anyone know how to add a tooltip to a column header in a TableView ?
有很多地方解释了如何将工具提示添加到数据单元格,但我没有找到将工具提示添加到标题的方法。
There are many places where are explained how to add the tooltip to data cells, but I didn't find a way to add the tooltip to header.
使用工具 ScenicView ,我可以看到标题是TableColumnHeader对象中的标签,但似乎它不是公共对象。
Using the tool ScenicView, I can see that the headers are Labels inside a TableColumnHeader object, but It seems that It is not a public object.
有什么建议吗?
推荐答案
TableColumn<Person, String> firstNameCol = new TableColumn<>();
Label firstNameLabel = new Label("First Name");
firstNameLabel.setTooltip(new Tooltip("This column shows the first name"));
firstNameCol.setGraphic(firstNameLabel);
这篇关于如何在JavaFX 8中向TableView标题单元格添加工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文