One more question is how to tell javafx.scene.control.Tooltip to stay visible for longer time and
stay visible while mouse is inside tooltip.
How to control duration after which particular Tooltip is shown?
Unfortunately, its public API doesn't allow this. Using openjfx 2.2 source code, I worked out the below hack which uses private classes and fields to override the default durations.
If you're not comfortable with accessing private fields, then you can subclass Tooltip and roll your own code based on TooltipBehavior to start timers, hide the window, etc. In fact for your
requirement that it should be visible as long as mouse is hovering, you'll probably need to roll your own code anyway.
I've actually managed to control the timeouts/delay of the tooltip by implementing the show and hide myself.
The repositioning of the tooltip at bottom-right is crucial since if you show it right under the mouse, the onMouseExited function will be called since the node will lose focus.
This code shows and hides the tooltip immediately upon enter/exit.
If you want to add timeouts, you can simple call the show/hide within a timer.
Joined: Apr 04, 2009
Guy, that's a really neat solution, bypassing Tooltip's inflexible design altogether! Thanks for posting and Welcome to Coderanch!