• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to control Tooltip visible time and duration before showing?

 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

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?

Thank you!
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for great reply!

I already use javafx8.

I'll try to subclass Tooltip and see what can be overridden.

Your method is really good.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Karthik, from my experience with the Swing sources, tracking that down must have taken considerable effort. Have a cow!
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darryl Burke wrote:Karthik, from my experience with the Swing sources, tracking that down must have taken considerable effort. Have a cow!


Yay, my first cow! Thanks much!
 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've actually managed to control the timeouts/delay of the tooltip by implementing the show and hide myself.

Instead of:


Try this:


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.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guy, that's a really neat solution, bypassing Tooltip's inflexible design altogether! Thanks for posting and Welcome to Coderanch!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic