Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX sporadic rendering issue - disappearing buttons / controls

I have a Java/JavaFX application deployed as a native install for Windows and Mac. The bundled runtime is currently 8.121. You can find the installers and the Java code here: George download

I have been using this application in the classroom weekly (with 20 children) for the last 15 months, and right from the start I have seen the following problem:

From time to time, buttons disappear. That is to say, they are simply rendered as a white rectangle, making them effectively almost invisible. Both the background and label/text disappear.

This mainly happens on mouse-over, but then does not correct itself. The buttons are still there, and clickable.

It only happens sporadically, but it seems to recur on certain machines more than others. Windows 10 now, but used to the same happened on tiny Windows 7 machines previously.

I am not able to reproduce it myself and have never seen it on a Mac, I think.

It now also happens sometimes with other widgets/controls, and even before any user interaction.

Is there some known issue around this? Has anyone else described something similar? Might it have something to do with certain minor operating system adjustments?

Any thoughts or ideas would be much appreciated.

Update (2018-11-06)

Just started testing my application in Java 8 in VirtualBox with Windows 10, and I now get the rendering error myself. Hurra!

Looking into the -Dprism.xxx options, I found this article: http://werner.yellowcouch.org/log/javafx-8-command-line-options/

Testing with -Dprism.threadcheck=true, I get a lot of "ERROR: PrismPen / FX threads co-running: DIRTY: false" with stack traces.

Setting -Dprism.dirtopts=falsedoes not solve it for me, though.

But running with -Dprism.order=sw does. But this is not a good solution for an application that may do some demanding rendering (Turtle Geometry).

Will keep digging.

like image 671
Terje Dahl Avatar asked Nov 28 '25 01:11

Terje Dahl


2 Answers

I've been having the same issue, I tried updating to Java 10 but the issue remained. I then edited the properties on java.exe and on the 'Compatibility' tab I set 'Override high DPI scaling behavior' to 'System (enhanced)' and the problem seems to have gone away (or at least it hasn't happened again yet).

enter image description here

like image 133
Greg Harley Avatar answered Nov 29 '25 14:11

Greg Harley


I observed the same thing: Visually disappearing (but still functional) buttons and other controls (except labels) especially in areas outside the original size of the window after I have resized it manually)

In my case -Dprism.dirtopts=false reduced the problem but also didn't solve it (and was not really a satisfying solution anyway).

Additionally I observed that some TextField controls also showed rendering glitches (looked like the same text was rendered twice with a little offset). That finally put me on the right track:

It turned out to be just a missing Platform.runLater(...) around some calls to TextField.setText(...) (from another thread) for exactly these TextField controls, which was causing this (even for e.g. a Button which is at a totally different place - also in the widget hierarchy).

I know, this is probably not the answer in all cases, but hopefully it helps at least some others facing the same problem (took me a full day to find out).

like image 27
Patter Avatar answered Nov 29 '25 14:11

Patter