4

I'm noticing when I add a tooltip to something (either through Scene Builder or in my controller), everytime I mouse over to see it, the font will get smaller and smaller. I've scoured the internet for the better part of the day looking for anything related to this and can't find any information on what is going on.

Below is the output of the font whenever I mouse over the control with a tooltip. It starts at 16, which is what I set it to, then inexplicably starts to shrink. Is this a problem with the library or am I doing something wrong?

Font[name=System Regular, family=System, style=Regular, size=16.0]
Font[name=System Regular, family=System, style=Regular, size=11.600000381469727]
Font[name=System Regular, family=System, style=Regular, size=9.899999618530273]
Font[name=System Regular, family=System, style=Regular, size=9.899999618530273]
Font[name=System Regular, family=System, style=Regular, size=9.899999618530273]
brutal11
  • 73
  • 6
  • 1
    Perhaps you are seeing: [RT-34948: Font size for tooltips are incorrect and inconsistent](https://javafx-jira.kenai.com/browse/RT-34948), which was recently fixed. Try the [latest development build](https://jdk8.java.net/download.html) and see if you still have the issue. – jewelsea May 15 '14 at 21:13
  • thank you for the info! i installed the new jre and jdk, but i'm still seeing the same behavior, unless there's some other setting i need to change to use the new build. i was able to force it to work properly just by setting the tooltip whenever the control is moused over. i don't like it, but it works. – brutal11 May 15 '14 at 23:31
  • Yeah, I don't know you are seeing this behaviour. I can't replicate this at all on Windows 7, Java 8u20b13. – jewelsea May 16 '14 at 00:35
  • I've seen this (fairly recently), but I can't reproduce it now. Can you update the question with a simple, complete, executable example (or just post one to JIRA)? – James_D May 16 '14 at 02:27

2 Answers2

2

Chrismelman's answer did not work for me but I modified his solution so that it did.

Before:

<Tooltip text="Some Text.">
   <font>
      <Font size="24.0" />
   </font>
</Tooltip>

After:

<Tooltip text="Some Text." style="-fx-font-size: 24px"/>

So you just delete the font tags in you tooltip and then add a style setting"-fx-font-size" to the size you want using either "pt" or "px" as units of font size.

sazzy4o
  • 3,073
  • 6
  • 34
  • 62
0

I fixed it by removing the font tag and place the setting it the style attribute.

Before:

<Tooltip text="Some Text.">
   <font>
      <Font size="24.0" />
   </font>
</Tooltip>

After:

<Tooltip text="Some Text." style="--fx-font: 18pt &quot;System&quot;;"/>

Note: It is a workaround, hopefully they will fix it in some release.