Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282229

Customizable visibility timing for Tooltip

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 8u341
    • javafx
    • None
    • source
    • minimal
    • The Compatibility Risk is minimal since only new APIs are added.
    • Java API
    • JDK

      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

      1. showDelayProperty
      2. showDurationProperty
      3. 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">&lt;duration&gt;</a></td>
      +            <td>1000ms</td>
      +            <td>&nbsp;</td>
      +        </tr>
      +        <tr>
      +            <td class="propertyname">-fx-show-duration</td>
      +            <td class="value"><a href="#typefont" class="typelink">&lt;duration&gt;</a></td>
      +            <td>5000ms</td>
      +            <td>&nbsp;</td>
      +        </tr>
      +        <tr>
      +            <td class="propertyname">-fx-hide-delay</td>
      +            <td class="value"><a href="#typefont" class="typelink">&lt;duration&gt;</a></td>
      +            <td>200ms</td>
      +            <td>&nbsp;</td>
      +        </tr>
      +
      

            kabhishek Kumar Abhishek (Inactive)
            josmithjfx John Smith (Inactive)
            Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: