Label baseline offset with a graphic

Martin Sladecek martin.sladecek at
Tue Jun 3 12:25:50 UTC 2014

Hi Werner,
this has changed in 8u20. See


On 06/03/2014 02:11 PM, Werner Lehmann wrote:
> Hi,
> I am trying to align labels on their baseline in an hbox. This is 
> surprisingly difficult if some of the labels have a graphic (on the 
> left). Turns out that
>    LabeledSkinBase.computeBaselineOffset()
> simply uses the max of the text baseline and the height of the graphic:
>    h = Math.max(textBaselineOffset, g.prefHeight(-1));
> So, if the label has no graphic its height is 17 with baseline 13. 
> With a 16x16 graphic the height is still 17 but the baseline changes 
> to 16. Which of course messes up the baseline alignment to other 
> controls.
> Doesn't it make more sense to use the baseline of the actual text 
> (possibly adjusted if the graphic is big)?
> Screenshot:
> Werner

More information about the openjfx-dev mailing list