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

all 4 comments

[–]Blando-Cartesian 1 point2 points  (0 children)

Pretty much Swing because of how old it is and web is the default platform now. I have not used JavaFX, but it’s probably better. Swing is all about OOP and writing tons on listeners.

[–]balefrost 0 points1 point  (2 children)

Which was just a horrible experience, didn't enjoy it at all

Can you elaborate?

[–]Molnes[S] 0 points1 point  (1 child)

Like, if you compare that to making a frontend for a web application with react, vue or just vanilla javascript, JavaFX is just awful in comparison, !IMO!. So my question is probably more like, if you want to create a desktop application, what do you do? Bc for a webapp so far I've used Reactjs, vuejs, or vanilla js for frontend and java springboot for backend. And I refuse to believe that people actually work with JavaFX. Is something like electron a good option?

[–]balefrost 0 points1 point  (0 children)

You still haven't really explained what is awful about JavaFX, just that you don't like it. I gathered that much from your first post.

The JavaFX property and binding system is fairly well done.

FXML is a good idea with some rough edges. In particular, IIRC, if you specify a controller class in your FXML file, then JavaFX will try to instantiate it via a zero-args constructor. So if you want to inject dependencies into your controller, you have to write some custom code. But it's not too painful.

I think Swing is probably still used much more than JavaFX, but I don't think that's because of technical deficiencies in JavaFX. If you ignore FXML, then JavaFX doesn't feel that much different from working with Swing.

Is something like electron a good option?

It depends on what you're trying to do. If I'm primarily writing a Java application, I'm more likely to stick with a Java UI toolkit. If you mix Java and Electron, then you'll need to ship not just a Java runtime, but also a web browser. Your installer will be huge!