Summary
Add APIs to support customizable visibility timing for Tooltip
Problem
New APIs need to be added that allows an application to customize the visibility timing for tooltips on JavaFX controls.
The ability to control these three properties: showDelay, showDuration, and hideDelay was added to JavaFX in JDK 9. The inability to control this functionality was missing functionality in the existing Tooltip API of JDK 8, as opposed to being a new feature.
Solution
Added below properties to support customizable visibility timing for Tooltip
- showDelayProperty
- showDurationProperty
- hideDelayProperty
Added getter, setter and property methods for these properties.
Specification
javafx/scene/control/Tooltip.java
+
+ /**
+ * The delay between the mouse entering the hovered node and when the associated tooltip will be shown to the user.
+ * The default delay is 1000ms.
+ *
+ * @since JavaFX 8u341
+ * @defaultvalue 1000ms
+ */
+ public final ObjectProperty<Duration> showDelayProperty()
+ public final void setShowDelay(Duration showDelay)
+ public final Duration getShowDelay()
+ private final ObjectProperty<Duration> showDelayProperty
+
+ /**
+ * The duration that the tooltip should remain showing for until it is no longer visible to the user.
+ * If the mouse leaves the control before the showDuration finishes, then the tooltip will remain showing
+ * for the duration specified in the {@link #hideDelayProperty()}, even if the remaining time of the showDuration
+ * is less than the hideDelay duration. The default value is 5000ms.
+ *
+ * @since JavaFX 8u341
+ * @defaultvalue 5000ms
+ */
+ public final ObjectProperty<Duration> showDurationProperty()
+ public final void setShowDuration(Duration showDuration)
+ public final Duration getShowDuration()
+ private final ObjectProperty<Duration> showDurationProperty
+
+ /**
+ * The duration in which to continue showing the tooltip after the mouse has left the node. Once this time has
+ * elapsed the tooltip will hide. The default value is 200ms.
+ *
+ * @since JavaFX 8u341
+ * @defaultvalue 200ms
+ */
+ public final ObjectProperty<Duration> hideDelayProperty()
+ public final void setHideDelay(Duration hideDelay)
+ public final Duration getHideDelay()
+ private final ObjectProperty<Duration> hideDelayProperty
+
javafx/scene/doc-files/cssref.html
+ <tr>
+ <td class="propertyname">-fx-show-delay</td>
+ <td class="value"><a href="#typefont" class="typelink"><duration></a></td>
+ <td>1000ms</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td class="propertyname">-fx-show-duration</td>
+ <td class="value"><a href="#typefont" class="typelink"><duration></a></td>
+ <td>5000ms</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td class="propertyname">-fx-hide-delay</td>
+ <td class="value"><a href="#typefont" class="typelink"><duration></a></td>
+ <td>200ms</td>
+ <td> </td>
+ </tr>
+
- csr of
-
JDK-8282003 Customizable visibility timing for Tooltip
-
- Resolved
-
- relates to
-
JDK-8090477 Customizable visibility timing for Tooltip
-
- Resolved
-