Some visual issues with a test application

Mark Raynsford org.openjdk at
Mon Oct 15 08:54:36 UTC 2018


On 2018-10-14T23:36:37 -0500
Ty Young <youngty1997 at> wrote:
> but I digress, JDK 11 switched to GTK3 by default which has caused some 
> bugs. Try setting:
> -Djdk.gtk.version=2

This fixes the menu issue (thanks!) but it doesn't fix the issue with
the icons in the table. Is there an open bug for the menu issue that I
can track?

Is there anything I can do about the table icons? I mean, not having
them at all is one option, but I'm mildly concerned that that's a
band-aid on a more serious problem (although you seem to be suggesting
that I've not made any obvious mistakes in the code).

> > criticism is also welcome.
> >  
> If I may ask, why are you sidestepping constructors and using static 
> everywhere? It works all the same, just never seen anyone write code the 
> way you did.

It's a couple of things: One is that I prefer to keep constructors as
side-effect free as possible. The other is that I approached this code
as I would have done with Swing. In Swing, it's more typical to extend
existing API classes like JFrame and so on than it is to aggregate
them. Doing so inevitably leads to rather large constructors that do
all sorts of work like instantiating other components, setting up
layouts and the like. This almost inevitably leads to the code leaking
the "this" reference to other code within the constructor, and this is
rather bad practice (passing a not-yet-completely-constructed value to
other code is a recipe for bugs). As such, I tended to write Swing code
where all of the complex initialization happens in static factory
methods. I agree it looks rather odd. There's actually a "bug" in the
OBBrowserWindow code in the sense that I don't pass any references to
the constructor. This whole project is very much a sketch pad for
getting to grips with how to write a real application with JavaFX, so
I'm not too bothered.

Mark Raynsford |

More information about the openjfx-dev mailing list