A perfect java blog

CSS : Tooltip Skinning

7 March,2012Narayan G. Maharjan

Hello I’m back with the small css skinning for the Tooltip.
Firstly the idea of this blogging came from this forum post. One guy was posting about how to make the tooltip plain as of swing which is concern about the css skinning.

I have been trying to style the tooltip recently and was very interested in your article. One thing that I was not able to acomplish, is to change the font color. I hoped you had tried this in your tests, but I see you havent.

Currently there is nothing like that . But I would recommend you to add some event handler in mouseOut and mouseIn of the Control where you are using that Tooltip. And control the disable and enable of the Tooltip by using hide() or show() function . Or even more you can control the timing of the hiding the Tooltip on event handler of onShowingProperty

.ttoltip as the default css style is not working…. at least here using Java 8 sith build 86… and it didn’t worked on 2.1 or 2.2 we need to use the “base” css class cause we have several (houndreds may be) tooltips on our App and we don’t want to take the risk to loose any of them on applying the style.

Hi carlos,
.ttoltip is not the default css style class use .tooltip instead. Did you see that I used “.ttip” because I have defined getStyleClass().add("ttip");. If you don’t want the user-defined class then use base class “.tooltip“.

Hi shyam,
I am afraid to know about the javafx css incompatibility because there should not be difference in CSS codes. Please check your css code correctly. I could help if you could print me some css code and your actual javafx version.

Seems to be a “broken tooltip” implementation on JDK8 tooltips are not being styled from css and FXML, they are using modena like the main styled sheet, you can set a “similar” sheet as your agent and style the tooltip there. This is a very risky work around since it can be css values that are not given to a control and you can brake something that is not broken. I hope this bug is fixed soon, in build 91 of JDK 8 haven’t been resolved.
Greetings

Hi Nono,
I have tested your code in Jdk 8u11 it works very great. But I don’t know of javafx 2 as I don’t have old version of Javafx2 . May be your css is not taking correctly by Eclipse I am right now in Netbeans. I am sure that it should work as I had written this blog post during the Javafx v.2 release time.I have attached an image

I am currently having a issue with the tooltip cursor. My issue is pre-tooltip I click something my cursor changes to a image, than when I drag that image(the cursor) over a object and the tooltip pops-up, the image-cursor turns into the arrow cursor. How can I stop the tooltip cursor from interfering with the image cursor.