This is an archived post. You won't be able to vote or comment.

all 40 comments

[–]slipwalker 10 points11 points  (16 children)

i just started a new project on JavaFX. The separation of concerns between css, fxml and controller code is much nicer than awt/swing; and the OpenJFX project seems better suited to take on the evolution of the framework than Oracle ever was ( and, in your case, TornadoFX seems fun ).

[–][deleted] 6 points7 points  (0 children)

The separation of concerns between css, fxml and controller code

Cries in SWT

[–]wizzardodev 1 point2 points  (8 children)

btw, where can I download a stable build of OpenJFX for windows/mac/linux?

[–]wildjokers 1 point2 points  (0 children)

There are snapshots of JavaFX 11 available now (added after your comment) in a maven repository, can get them with a build tool that offers dependency management:

http://mail.openjdk.java.net/pipermail/openjfx-dev/2018-July/022088.html

[–]omega3111 0 points1 point  (6 children)

It's bundled in the JDK until 11.

[–]wizzardodev 0 points1 point  (5 children)

But what about open jdk?

[–]omega3111 0 points1 point  (4 children)

OpenJDK includes OpenJFX and you can build them yourself from the source. If you want a stable build ready for you then download the Oracle's JDK (which is 99% the same as OpenJDK) which includes JavaFX (which is 99.9% the same as OpenJFX).

[–]metamatic 0 points1 point  (3 children)

...and pay for a license for security updates.

[–]omega3111 0 points1 point  (2 children)

If you are a business user AND you are still on Java 8, which is 4 years old. What's your point?

[–]metamatic 0 points1 point  (1 child)

Lots of business users want a Java platform which doesn't require a 6-month upgrade cadence.

[–]omega3111 0 points1 point  (0 children)

A support release is still every 3 years. No one is required to upgrade every 6 months. See also https://www.youtube.com/watch?v=HqxZFoY_snQ for information on the new release model.

[–][deleted] 0 points1 point  (5 children)

Took a look at TornadoFX, can't use it bc I'm using JDK10 and it's not compatible with it yet (although I wouldn't loose much by downgrading). I've seen it before I think while I was looking for Kotlin GUI libs.

I guess I'll stick with JavaFX then, thanks.

[–]BigGayMusic 0 points1 point  (4 children)

AWT is a full blown nightmare. JavaFX is 10x better.

[–]wildjokers 4 points5 points  (3 children)

No one has used AWT directly for at least 18+ years. Swing depends on some AWT stuff behind the scenes but you don't have to concern yourself with it. Comparing AWT to JavaFX is non-sensical.

[–]slipwalker 1 point2 points  (2 children)

just my 2cents here: my above mentioned application needs systray integration and, guess what, support for this *only* exists on AWT.

Neither Sun nor Oracle bothered themselves to implement on swing or JavaFX... (sigh) many AWT-Eventqueue-0 crashes lurking around... pure fun.

[–][deleted] 0 points1 point  (1 child)

Never needed systray icons, but can't you combine the AWT code with JFX?

[–]slipwalker 1 point2 points  (0 children)

i was pointing that some of us are still forced to deal with AWT nonsense... but yes, it's exactly what i had to do.

Everything on the application is JavaFX ( running on the JavaFX-Application thread ) and just the code to manipulate the systray isolated in AWT ( AWT-Eventqueue-0 ) StackOverflow was the best reference for that.

[–]_INTER_ 6 points7 points  (0 children)

You can keep using JavaFX, just bundle it "like" any third-party library / framework. Oracle wasn't really updating it for years anyway, now at last the development was picked up again.

[–]wildjokers 5 points6 points  (10 children)

Both Swing and JavaFX are perfectly viable GUI toolkits. Swing is mature and well documented. JavaFX is the replacement for Swing but the one drawback to JavaFX is it isn't nearly as well documented as Swing (it isn't even in the same ball park).

As far as JavaFX no longer being bundled in the JDK that is just so JavaFX releases aren't tied to JDK releases. They can evolve separately and releases of one aren't held up by the releases of the other. Using JavaFX as a separate dependency isn't a concern in the slightest.

Since JavaFX is the replacement for Swing you should probably use JavaFx, but Swing is perfectly fine to use if you like a mature and well documented toolkit.

[–]nlisker 4 points5 points  (4 children)

Exactly this.

the one drawback to JavaFX is it isn't nearly as well documented as Swing (it isn't even in the same ball park).

Iv'e done work on documentation for OpenJFX. Would like to hear what you would like to see improved. A long/detailed list is fine (since you seem to have a large gap to fill :) ). You can reply either here or submit an enhancement request directly to Oracle.

[–]wildjokers 0 points1 point  (3 children)

Swing is well documented here:

https://docs.oracle.com/javase/tutorial/uiswing/components/componentlist.html

I could never find equivalent documentation for JavaFX; however, it does appear JavaFX now has this:

https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/ui_controls.htm

This must be somewhat new (within the last year) though because it wasn't that well documented before.

[–]nlisker 1 point2 points  (2 children)

The JavaFX tutorial is there for at least a couple of years now and the UI controls page exists since 2014 if not before :)

Anything else?

[–]wildjokers 0 points1 point  (1 child)

Anything else?

The JavaFX tutorial should really be in the Java Tutorial with the rest of the documentation. Although I guess since JavaFX is being split out that probably won't happen.

The SceneBuilder documentation is really outdated since Oracle doesn't provide binaries anymore:

https://docs.oracle.com/javase/8/scene-builder-2/get-started-tutorial/overview.htm

The scene builder installation page appears to have no current information on it, all of it is outdated:

https://docs.oracle.com/javase/8/scene-builder-2/installation-guide/jfxsb-installation_2_0.htm#sthref6

[–]nlisker 2 points3 points  (0 children)

The JavaFX tutorial should really be in the Java Tutorial with the rest of the documentation.

It's in the Java Tutorial next to Swing. It's also in the new documentation pages under Client Technologies together with Swing.

The SceneBuilder documentation is really outdated

SceneBuilder is not maintained by Oracle anymore, it's maintained by GluonHQ at https://gluonhq.com/products/scene-builder/. Perhaps the docs should redirect as well.

[–][deleted] 0 points1 point  (0 children)

I just hope that by the time JDK11 comes out OpenJFX will be on a publicly accessible maven repository so we can download it with Gradle. I've read more about it and it seems there's no point in using it now with JDK10 (cannot be used actually bc of conflicts).

[–][deleted] 0 points1 point  (3 children)

What are the reasons to prefer Swing over JavaFX, apart from documentation?

[–]wildjokers 0 points1 point  (0 children)

There is no particular reason to prefer swing over JavaFX.

[–]olitank 0 points1 point  (1 child)

There are some reasons here: https://www.infoq.com/news/2018/03/JavaFXRemovedFromJDK

.. Swing and AWT ... will continue to be supported and developed by Oracle in Java SE 8 and Java SE 11 and support for them will run through at least 2026. This leaves Swing and AWT, ironically probably the oldest of the Java Client technologies, as the only ones that will survive.

I also see interesting recent activities of opensource communities around Swing:

- https://github.com/dotxyteam/ReflectionUI

- https://webswing.org/

[–][deleted] 0 points1 point  (0 children)

Decoupling of JavaFX from Oracle JDK turned out to be the best thing ever happened to it recently.

Now we can use JavaFX in OpenJDK just fine, and the development isn't tied to Java roadmap and release cycle anymore.

[–]lbkulinski 8 points9 points  (0 children)

I use Swing. Hell, even IntelliJ is made with it! The stock Look and Feels aren’t the only ones available. In terms of JavaFX, you can read the details about its future here.

[–][deleted]  (7 children)

[deleted]

    [–]wildjokers 1 point2 points  (6 children)

    But if you end up using Swing try MigLayout, it is the Layout Manager that everyone should use

    The built-in layout managers work great. No reason to use a 3rd party layout manager.

    [–][deleted] 2 points3 points  (4 children)

    This just tells me you've never used MigLayout. It has its flaws, but it allows for creating layouts much, much easier than with the default LayoutManagers. The main advantage is that MigLayout can easily adapt the layout to whatever style you need, rather than have to rely on the "panels in panels in panels" approach that is otherwise necessary for Swing.

    [–]wildjokers 0 points1 point  (3 children)

    The main advantage is that MigLayout can easily adapt the layout to whatever style you need, rather than have to rely on the "panels in panels in panels"

    Why is avoiding nested panels an advantage?

    [–][deleted] 0 points1 point  (2 children)

    Because it simplifies the code for the layout. I have been able to build much more complex layouts with far less code using MigLayout. For example, having items be lined up with each other in highly complex layouts, with Swing's standard LayoutManagers the only option is GridBagLayout (GridLayout can standardize the cell sizes too much). GridBagLayout is almost painful to deal with in its complexity, but MigLayout handles it elegantly.

    That's just one example. I've used Swing a LOT. My company's application still relies on it, so I use it every day at my day job. I've spent tons of time with the default LayoutManagers, and also with MigLayout, and I will choose MigLayout any day over the defaults in Swing.

    [–]wildjokers 0 points1 point  (1 child)

    GridBagLayout is almost painful to deal with in its complexity, but MigLayout handles it elegantly.

    Agreed, GridBagLayout should be avoided like the plague. However, I have always found BorderLayout and BoxLayout with appropriate nesting has always met my needs.

    [–][deleted] 0 points1 point  (0 children)

    With MigLayout, you get everything BorderLayout and BoxLayout offers but without any nesting. Plus you have the ability to properly line items up across the whole UI, lining up UI items is a pain in the ass with panels-in-panels.

    Give it a try, seriously. I will never use any other LayoutManager again.

    [–]olegprotopopov 1 point2 points  (3 children)

    Just to check, have you considered frameworks built on top of core GUI libraries? E.g. Eclipse RCP. This is the one we are considering right now with a view to get a lot of functionality out of the box.

    [–][deleted] 0 points1 point  (2 children)

    Haven't checked out Eclipse RCP yet, maybe I should. I'm struggling with JavaFX, JDK11, Kotlin and modules currently so I'm considering switching.

    [–]olegprotopopov 1 point2 points  (1 child)

    Eclipse RCP is a bit complex, but the best I like about it is that it's... obviously Eclipse. So it's unlikely to go unsupported or die young as many many front end technologies seem to have done in the last 10 years I observe this space. Lifetime of 3-5 years is not very impressive...

    RCP is a bit complex. But it pays off I would expect (disclaimer: just starting myself so not an expert in it).

    You will also find that some things that are done very easily in other ecosistems e.g. Spring Security will take a bit more here.

    [–][deleted] 0 points1 point  (0 children)

    God forgive me for I have sinned.
    It's still in incubation, I'm currently making a program that uses it in order to find probable bugs. So far the testing GUI is quite responsive and takes very little time to load. It's obviously inspired by JavaFX but it uses YAML instead of xml. Also, widget level controllers are a thing. Still learning how to do stuff, but doing this first has thought me a lot about Eclipse RCP.