I made JavaFX app for my company. It is in the gambling space. Used to display jackpot related stuff, winners, current jackpots, promotions, etc. It is deployed to every betting shop (around 600 of them). It also interacts with central server and gambling machines.
I started with swing then shortly thereafter switched to JavaFX and it was a joy to use it for this usecase. Really easy to make what we needed in small amount of code and it is performing well and is really stable (runs 24h/7 without problems)
I actually did with my company and anyway it was a bad decision.
JavaFX and swing customization is really not easy and not well documented. JavaFX uses custom XML which make no sense to be honest when you want to do nice design.
And it requires custom CSS too.
Additionally, their design are bad(I mean their Java API).
We spend a whole year making an app with it, at the end we decided move away from it, like the rest of the java community if fact that do not really support desktop applications anymore.
> JavaFX uses custom XML which make no sense to be honest when you want to do nice design.
I don't see why the custom XML should be a problem. Definitely you are not supposed to edit the .fxml files by hand, especially when you have apps like Scene Builder that allow you to design everything from a GUI.
> And it requires custom CSS too.
That's true only for a few JavaFX-specific properties. The CSS syntax doesn't change very much. Also, it's not a surprising feature: QT, the C++ GUI framework, also uses custom CSS.
Btw, this project started when my sister and I were eating at Panera and decided it would be fun to each write an HN front-end. Hers was largely a project to learn React, which you can see here: http://coribeecroft.com/hacker-news-frontend/
She's looking for work at the moment if anyone knows of someone who might want to hire a somewhat junior but very smart developer with a good sense of humor. See here for more: http://coribeecroft.com
Haha! Thanks! I can't really say this is representative of the best modern Swing has to offer, though, so I hope people won't judge it too much by my joke project ;)
Ask HN on Show HN: Why is Swing UI still so Ugly ?
2 Decades since it's introduction in 1997 ( I remember being forced to use it in a trading OMS application in 2002), Swing UI looks frozen in time, ugly as ever.
Part of that is because Java has basically moved onto JavaFX over Swing—and partly it's because I built this specifically to resemble old Swing apps :)
I'm a big fan of FRC, but a lot of those techniques are about "special-case" UIs, the way you see them in Web UIs or "multimedia" applications, not pleasing form and widget layouts. That's a bit of an intermediate step between just spewing forth UI elements and constructing fluid animated, mirrored list displays. And sadly often neglected, especially if your tools don't take care of it automatically (layout engines, Interface Builder etc.). Java and Tcl didn't have to look that bad, but sadly they often do.
"Filthy Rich Client" only shows how to do it, but it's still much, much harder than in QML (even Qt Widgets supported CSS styling) and WPF. I would say by a factor of at least 5 regarding QML and slightly less for WPF.
IntelliJ is what a Swing app might look like after more than a decade of work and shipping (at times) with a custom-built JRE. It's not an effort most can and should spend to get to 'decent'.
Swing uses a pluggable 'look and feel' system (essentially themes)—which does include a 'native' look and feel for various OSs, including Windows and macOS.
Because Sun made the boneheaded decision (and never admitted it was dumb) to go for emulated widget controls instead of native ones. What this means is that they have had to reimplement and imitate the behavior of native controls on all platforms (realistically, Windows only) every time Microsoft came up with a new version.
In contrast, IBM took the native approach with SWT / JFace, and the interfaces written with that library look and feel infinitely more native and performant than Swing and JavaFX ever did and ever will.
AWT wasn't native either - it just had one ugly appearance and couldn't be themed. I seem to recall it kind of resembled Sun's CDE (Common Desktop Environment) so it would have look sort of at home on Solaris.
Which do you care more about: it works, or it looks good? There's a reason Java became such a big platform for business applications and it isn't because it cared about fashion fads.
Can you name another very popular and very good looking Swing application?
Even if you can, you can count them on one hand. Swing was a massive failure, and rightfully so, because Swing/JavaFX apps look, and more importantly, feel, like a broken mess.
In contrast, SWT/JFace apps look a lot more native and feel extremely snappy. Apps build on the Eclipse RCP are in general pretty decent looking and they enable all the native controls and functionalities of the host platform.
Why? What value is looking good? There's value in a well designed responsive UX, but how it looks is completely meaningless to me because it doesn't help me get shit done.
Wow I had no idea, assumed it was JavaFX, it has a much nicer feel to it than the other 2 IDEs. Has Swing remained the same or has the API been overhauled since idk, SE6-ish around last I perused? NetBeans certainly has had a nice bit of a facelift last I saw of it. Eclipse I won’t say too much, looks like their splash screen is the only thing has had much of an overhaul.
"great" is subjective, my preference is for "native" and then you only have to decide what you think/feel looks good just once. JetBrains doesn't look native.
You can get a bit closer to native feel with JavaFX. It's still not there but it at least the default Moderna theme doesn't rock the boat like Swing does.
Thankfully JavaFX is pretty easy to customise, it's roughly writing CSS, and there's a few high quality themes out there. Take a look at JFoeniX[0] for example for a material design inspired look.
The only way is to change the Look and Feel, and unfortunately I think 'Nimbus' (which I show in one of the screenshots) is the most modern looking of the built-in Look and Feels. There may be some decent 3rd party options though... Like whatever IntelliJ is using.
I tried using the platform look and feel on macOS, but it gives a number of important elements tiny heights, including comments, making them unreadable. I'm sure there's a fix but I haven't looked into it.
As the author of this—yep, I can agree with that. I'm generally baffled when I see folks complain about Electron's slowness—but that's probably 'cause I started out building Swing apps :)
Memory usage is often a bad indicator of bloat. Especially GC languages like Java and JS will just go ahead and allocate a lot of memory from the OS without using all of it all the time. If you sum the "used" memory of all apps, it will often be more than the available RAM, even though there is no swapping going on. The OS memory management is really clever nowadays.
Actually, an app not using much memory may be sacrificing performance by not using a caching opportunity.
Unfortunately, apps coordinating how much memory to best use is an unsolved problem, as far as I know.
Is it really the case ? I would expect the language to expand the size of the heap only if after a GC the amount of free memory is still below a certain threshold.
Includes mention of alternate websites, mobile apps, and a pair of CLIs: haxor-news and hn-cli. I'm not sure but this might be the first desktop GUI app for HN I've heard of!
The HTML5 parsing in Java is awesome now! built a desktop app with Bootstrap 3 recently and the logic in Kotlin, fun stuff. Your Swing metal L&F is great :)
Very nice app and promising. However, I would the UI would look more "modern" (don't know if this is possible or not). Right now the button and the scrollbar is a bit outdated. The bonus point for me that this is written in Kotlin, not another Electron RAM killer app.
Very cool! I made a native macOS desktop client . It does use a web view to render the article but the article list, comments, voting, commencing, login interactions are all native . http://mackernews.com
Hey anon6412, so this was my first Kotlin project, and I don't really know much at all on the ecosystem. I could check out kotlinc and write up something on how to build with it—I imagine it's just adding ./lib to the classpath, though I'm not sure. There's no package structure to the source.
By the way there is still no HN OAUTH API. There are tricks to authenticate users and send messages but I don't want to share my password with a 3rd party.
Haha, yep, it was a lot of fun. Especially going back and using Swing after about a decade of using other UI libs—that was a very interesting experience. When I was initially using Swing it was all I knew and at first I thought of all new systems in terms of it. I even tried re-writing a super stripped down version of it on OpenGL way back when: http://symbolflux.com/statichtml/oldprojects/openglguisystem... :)
It is a regular JTree! —mostly. I am using a custom TreeCellRenderer, which uses a JPanel with some labels on top, and a JTextPane for to display the comment itself (since the HN API gives back comments as html, I use JTextPane to parse/render that html).
Edit: it also may look different if you aren't used to seeing the 'Nimbus' Look and Feel—its JTree looks fairly different.
1) don't start a new project in Swing when you could use JavaFX instead. Since you're using Kotlin, you'd also want to use TornadoFX, a nice DSL for JavaFX.
2) use Maven or Gradle (or hell, any build tool). Don't store artifacts in source control.
I was really hoping someone who knew what they were doing was building this after the mini Electron debate earlier this week :/
Hey kevinherron—thanks for the feedback. I actually was aware I could build something nicer with JavaFX, but one of the main constraints on the project was that it satisfy my nostalgia for old Swing apps (particularly the 'Metal' Look and Feel), so I decided to go in that direction.
As for building—I agree the current project structure is basically unforgivable :) However, I figured the chances of anyone seeing the project were extremely remote and it was just for fun so I didn't bother with any of the boring stuff. Maybe I'll fix it up a little now though.
Excuse a quick aside -- do you know of any good examples of real non-enterprisey apps using JavaFX?
Java desktop apps seem almost universally awful, but it doesn't seem like it has to be that way. I'd love to see some counter examples (IntelliJ's IDEs are honourable exceptions, but they're a bit of a special case).
Thanks, looks interesting. Scriptable in javascript too.
I always note with irony that professionals expect to pay decent money (Bitwig is $400) for software relevant to their trade; the one exception being software pros.
Programmers have a deep Stockholm Syndrome for infinitely customizable software. They’ll disparage IDEa while installing enough plugins to turn vim into an incredibly poor one. Also, there’s the typical Real Programmer BS that asserts dev tools peaked in the 70s.
It's really the expectations I was commenting on more than the pricing. I have heard devs on 100k plus whinge about $80 for a professional programmers editor, and rule out IntelliJ IDEs from their consideration because they're not 'free'.
When most "expensive" tools are put in terms of Starbucks lattes, they don't look bad. There's still the actual enterprise-targetted tier, but even up to the full Jetbrains Toolbox subscription, you're looking at what amounts to around a coffee a week.
I would really like to see a non-trivial app built on JavaFX in Kotlin, with the following properties:
- Does not look ugly.
- Is not composed of _merely_ OEM widgets. But includes custom elements, like one would normally see on websites (and by extension, Electron apps).
- Is lightweight and response, not just in terms of CPU and RAM, but in terms of user experience (think VSCode vs Android Studio).