JavaFX Content Rendering & Resizing and Font Bugs In Linux
siddheshrane at disroot.org
Sun Jan 6 11:06:59 UTC 2019
(An earlier version of this email turned out completely empty when delivered on the mailing list)
I have used JavaFX on Linux since 8.0 and have never faced any serious issues.
January 3, 2019 4:29 AM, "Ty Young" <youngty1997 at gmail.com> wrote:
> In my attempt to write a more proper responsive JavaFX UI, I've created
> a new JavaFX project which extensively uses DoubleBindings to force the
> min/max width/height of various components to their parent containing
> objects(HBox and VBox mainly) so that 1440p and 4k displays could be
> more easily supported.
This is not how layout is supposed to be done. The parent container calculates its computed size based on its children which takes into account min/pref/max size of children. Min/pref/max are intrinsic properties of the child irrespective of the container it is in.
You are introducing a chicken and egg situation here by having both dimensions depend on each other. You'll get undefined behaviour.
If you want children to occupy full width and height of parent, set VBox to "fill width" with Vgrow ALWAYS on children and Hbox to "fill height" and hgrow always in scene builder.
> While it does allow for easier 1440p and 4k
> scaling, JavaFX itself seems to have /extremely/ horrible content
> rendering & resizing bugs to the point where the application becomes
If you are taking about buttons being extremely small on high definition screens on Linux, you can set root font size in your css to >1.0em. Alternatively you can set default font size with - Dcom.sun.javafx.fontSize=18 where default is 12. You can try it for any javafx application by setting _JAVA_OPTIONS=-Dcom.sun.javafx.fontSize=18 on the command line.
> Multiple of the bugs can be observed by simply resizing the JavaFX
> window. When doing so, content will seemingly struggle to keep up with
> resizing events. As a result, white(or sometimes black) glitching can be
> seen wherever the window is being expanded and UI components will "jump"
White or black bars on window expansion are not specific to javafx. I've seen that on Windows file explorer and Chrome with Gmail tab. It seems to me that the window resizing happens asynchronously so it doesn't wait for the application to have calculated layout and painted the new area. For any complex UI, the layout computation cannot keep up with window resize.
> Thinking that this might be problems caused by extensive use of
> DoubleBinding, I launched SceneBuilder 10 which uses Oracle JDK 10. It
> has all of the same UI glitching that I've encountered in my JavaFX
> application at a lesser scale besides TableView since it doesn't use
Scene Builder is a complex application. Above point applies.
> Another problem is a font bug revolving around making text bold. When
> attempting to make a label bold, the boldness is seemingly not being
> applied to some Label text. It might work on a few Labels in a certain
> part of the UI but completely refuse in other parts. Making things
> weirder is the disappearing boldness of Labels after setting a new Pane
> in the ScrollPane and switching back to a that specific pane.
Without relevant code, we cannot comment.
More information about the openjfx-dev