Label baseline offset with a graphic
Werner Lehmann
lehmann at media-interactive.de
Tue Jun 3 12:11:26 UTC 2014
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: http://postimg.org/image/kv12r24z9/
Werner
More information about the openjfx-dev
mailing list