JavaFx添加ToolTip

By | 3月 28, 2017

1. SceneBuilder中添加

SceneBuilder -> Miscellaneous -> Tooltip,将其拖到对应控件里便可。

image

2. 通过code添加

Tooltip tooltip = new Tooltip("This is tooltip");
tooltip.setStyle("-fx-font: normal bold 16 Langdon; "
    + "-fx-base: #AE3522; "
    + "-fx-text-fill: orange;");
addRangeBtn.setTooltip(tooltip);