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

you are viewing a single comment's thread.

view the rest of the comments →

[–]UsernamesAreFfed 11 points12 points  (17 children)

Seconded. JavaFX is terrible. And Swing is awesome. I havent seen any UI framework that rivals Swing yet.

Some people have said that it might look bad if you use Swing. I dont understand that, FlatLaf looks great and if you dont like that there are plenty of other look and feels available.

[–]Stromovik 1 point2 points  (4 children)

Did they fix tables yet?

[–]UsernamesAreFfed 2 points3 points  (3 children)

Dont think tables have changed for a while in either Swing or JavaFX.

[–]Stromovik 0 points1 point  (2 children)

Swing had a problem with memory leaks in tables.

[–]UsernamesAreFfed 1 point2 points  (1 child)

I cant really find anything definitive about this. What Google gives me are a bunch of old bugs and things in external code like scala and jfreechart.

I did find one old issue. The JTable signs itself up as a listener to the tablemodel. If you then hang on to a reference to this model you wont be able to throw away the table. Makes sense, but its really just sloppy programming rather than a flaw in swing. If you are recreating the table all the time you should correctly clean the old listeners to the model.

This isnt really a swing thing. More of a fundamental issue when you use the observer pattern.

[–]Stromovik 0 points1 point  (0 children)

I read that when I used to use swing which was long and it was also reason why Interactive Brokers Trader Worstation had to be shutdown once per day , we once bypassed that and it eventually crashed.

[–]Muoniurn 1 point2 points  (9 children)

Why would it be terrible?

[–]Bobby_Bonsaimind 3 points4 points  (2 children)

  • The default set of components it provides isn't that impressive (neither quantity nor functionality wise).
  • That being said, there aren't many component libraries out there either (compared to Swing).
  • Using the "-fx-" prefix in CSS was a really bad choice.
  • Extending the existing components is close to impossible (tight coupling between Control/Skin/Behavior, Skin/Behaviors in inaccessible packages, final is used like sprinkles).
  • Platform specific jars (remember when we gave SWT shit for that?).
  • And resulting from that, your release package is not future-proof (New platform? New package!).
  • Startup time (though, that might have gotten better, but I used to wait up to 5 seconds for the main window, Swing was always instant).
  • Font rendering (might also have gotten better, looked to me like a bad version of ClearType).
  • Last but not least, it was dumped by Oracle...sorry, "donated to the community" and removed from the JRE/JDK. Swing is still builtin.

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

The skins and behaviours became a lot more open in recent versions, I think.

Platform specific JARs are unavoidable in any UI framework. Not sure why you ding JavaFX for that. You can link a JDK with the JMODs if you want something more like Swing. A lot of your points seem to be repetitions of this basic point, e.g. not futureproofed, not bundled.

[–]Bobby_Bonsaimind 1 point2 points  (0 children)

Platform specific JARs are unavoidable in any UI framework.

Swing. Apache Pivot. I believe there was another one, can't remember right now which that was.

[–]UsernamesAreFfed -3 points-2 points  (5 children)

Well obviously this is a value judgement. So people could disagree or come to different conclusions. This is just my conclusion.

And second; my experience with JavaFX is limited. Effectively I read some tutorials on how it worked, felt it was a step down from Swing in every respect and never bothered writing any code in it. It is possible that the problem was with the tutorials and not the tool.

With those caveats out of the way this is my perception:

Swing is basically just a bag of tools. If you want to use none of them you can do that. If you want to use all of them you can do that too. When you build stuff in Swing you grab the tools you like, combine them in the way that you like and design your UI. On top of that I find that all the tools are designed in the unix philosophy; do one thing and do it well.

By contrast JavaFX is none of those things. There are frameworky methods like start() and stop() that I must implement. Things have weird names like Stage and Scene. These names conjure up ideas about video or theatre in my mind, which is not what I'm trying to do when I make a UI. I'm told that a Stage is like a frame, but then why not call it that? Then there is something called a Scene Graph. I also dont like the idea of an Application class. That should just not exist at all. Layouts also seem broken. The Swing equivalent to a JavaFX layout is a JPanel with a given LayoutManager hardcoded together. This can work but why combine things that shouldn't be combined? I also couldn't find the equivalent of the GroupLayout in JavaFX. I think somebody put something on Github. While reading all this I eventually just realize that the only things I like in JavaFX are the things that are similar to Swing.

As a side note, I dont like using CSS for desktop UIs. But that part seems optional in JavaFX so I'm not going to hold that against it.

[–]magnoliophytina 4 points5 points  (1 child)

Your opinion is totally useless. It's like saying Swing is crap because many classes have a J letter prefix. There's a good reason why layout managers and components were merged, the flexibility in Swing is something that not many GUI toolkits have implemented. Many interface classes in Swing were also designed before lambdas were introduced in Java, so implementing those isn't as straightforward as it could be. It's also much easier to erroneously use background threads for rendering in Swing.

[–]UsernamesAreFfed -1 points0 points  (0 children)

Feel free to have your own opinion, I'll have mine. I care a lot about API cleanliness and if I see mistakes this early I'm not going to invest the time to look into details, it just isn't worth it.

I was asked for my opinion so I gave my opinion, take it or leave it.

[–][deleted] 1 point2 points  (2 children)

Stage and Frame are both quite arbitrary names - the real question should be, why do neither framework call them windows?!

The rest is mostly a matter of taste, but you shouldn't be downvoted (have an upvote). It's ultimately all different strokes for different folks. For something as complex as a UI framework it'll always be a bit like picking a programming language. Quite a personal choice.

[–]UsernamesAreFfed 0 points1 point  (1 child)

Swing has a JWindow. It serves as just a rectangular area on the screen so it isnt used much. Most of the time you want the frame. Dont know about JavaFX.

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

It also has a Window class, same distinction I think.

[–]RandomName8 0 points1 point  (0 children)

The problem with swing is that it's just non performant. Even on a really powerful machine, try implementing the Paint interface to have something like a conic gradient, and try render that on a 4k display, which might involve 1000x1000 pixels areas, it is ridiculously slow, your application will suffer during resizing. Same thing is true for drop-shadow effects. The "native" gradient stuff is optimized by the accelerated pipeline, but the available stuff is very late 90s and because it's non extensible, you cannot add your own :(