FXML and high dpi screens

Danno Ferrin danno.ferrin at shemnon.com
Fri May 17 06:27:10 PDT 2013

I think it should be addressed in the fxml.  In fact, I think it can all be
done in com.sun.javafx.fxml.BeanAdapter, at least relative to the default
font, inside the coerce method.  The coerce method could be adapted to add
some context object so that the font of the current or enclosing font could
be used too, but for my needs the default font would work

I'll try and get a patch together in the next few days to demonstrate my

On Fri, May 17, 2013 at 2:10 AM, Milan Kubec <milan.kubec at oracle.com> wrote:

> Hello,
> in general FXML allows the same functionality as regular Java APIs of
> JavaFX, where px is used as main unit. So your requirement should be
> addressed to JavaFX APIs not to FXML. EM can used in stylesheets, but
> that would probably not help you much.
>   Milan
> Dne 16.5.2013 20:51, Danno Ferrin napsal(a):
> > Executive summary: Is there any way in FXML to specify the sizes of the
> > components in units other than pixels?  Either now or in the future?
> >
> > So I am running a Java Swing Application on a Surface tablet with
> multiple
> > embedded FXPanels (mostly to deal with cross toolkit dialog modality...
> an
> > issue for another thread).  In order to not get the horrible blurred view
> > (since surface does 150% font scaling) I turn off the dpi fixing for the
> > java app, so the swing app is pixel to pixel for the most part, with some
> > dramatic sizing issues with the XP theming (an issue I don't expect ever
> to
> > be fixed).
> >
> > So I have an FXML panel that is supposed to be 560x400, and I literally
> get
> > 560px by 400px.  But the widgets are all sized in EM, which respects the
> > native DPI scale.  I don't want to turn that off, because in this case I
> > like it.  But the widgets scale up, so it sizes like a 373.333x266.666
> > panel.  What I do want to be able to do is specify the FXML sizes in EM,
> so
> > I would call it 35em x 25em.  Is there a way in FXML to specify these?
>  Or
> > will I have to do multiple FXMLs mechanically scaling the sizes up.  Or
> is
> > there some escape sequence or auxiliary data I can add to say "scale
> pixel
> > sizes by 150%"?

More information about the openjfx-dev mailing list