News for hackers. Stuff that matters.
Re:The decline and fall of Java on the desktop by cosmotic on Wednesday March 02, 2022 @01:47PM (#30531127)
Java Swing still lets you make native-looking-and-feeling apps (with some care). I don't know of any new GUI frameworks that let you do the same. I consider this a killer-feature of the framework. It's also very fast, backed by OpenGL and DirectX. It also ships with source code and isn't declarative, so it's trivial to step into as a means to debug why your code isn't working.
Re:The decline and fall of Java on the desktop by jjoonathan on Wednesday March 02, 2022 @02:05PM (#30531390)
> native-looking-and-feeling apps

Who are you kidding?

> (with some care)

No. Even if you were to give it more care than required to rewrite the GUI natively in each major platform, you still wouldn't be close.

Look, I get it, there are plenty of applications where a bit of clunk in the GUI is beneath other things on the priority list. That's fine. But the number of java devs who think clobbering together a few native widgets means they have constructed a native experience is... disconcertingly high. There's a whole GUI world out there beyond the lowest-common-denominator, and Swing isn't even the best at that.

Your priorities might still be perfectly rational. I might even make the same decisions under the same constraints. Just... be aware of what you're trading away

Re:The decline and fall of Java on the desktop by cosmotic on Wednesday March 02, 2022 @02:52PM (#30532062)
Certainly the default L&F is not native looking, nor are any of the popular community L&Fs. Though one can simply set the L&F to the native look and feel with essentially one line of code. The little care I'm referring to is around polish to get beyond the lowest-common-denominator. Regardless, system L&F with Swing is still worlds better than any Electron app, which is now a common technique to build cross platform apps.
Re:The decline and fall of Java on the desktop by marwis on Wednesday March 02, 2022 @03:45PM (#30532859)
Windows LnF hasn't looked native since WinXP and never felt native. Lots off things are off by few pixels, there are no animations or shadows, no context menus etc.

At least in Electron textboxes have standard context menu and drag and drop.

Re:The decline and fall of Java on the desktop by morelisp on Wednesday March 02, 2022 @02:53PM (#30532073)
> the number of java devs who think clobbering together a few native widgets means they have constructed a native experience is... disconcertingly high.

It's absolutely a psyop cover for the number of webkit-in-a-box projects that don't even bother with the first step. Normalized deviance.

Re:The decline and fall of Java on the desktop by pjmlp on Thursday March 03, 2022 @02:05AM (#30538025)
No they aren't, provided that the developers actually bother to read books like "Filthy Rich Clients".

https://www.amazon.com/Filthy-Rich-Clients-Developing-Applic...

Re:The decline and fall of Java on the desktop by victor106 on Wednesday March 02, 2022 @02:28PM (#30531712)
Re:The decline and fall of Java on the desktop by Macha on Wednesday March 02, 2022 @02:32PM (#30531766)
Swing's platform look and feel does not get a convincing native experience, as you'll find out the first time you open a JFileChooser on Mac and see a clone of the windows XP file picker with widgets made to look like mac OS widgets circa Snow Leopard.
Re:The decline and fall of Java on the desktop by shannah78 on Wednesday March 02, 2022 @03:19PM (#30532496)
The FileDialog is the only AWT widget I still use regularly. It gives you the native file chooser. Unfortunately it isn't terribly flexible when it comes to, for example, only selecting directories. In those cases, I have been known to use JNI to use the truly native dialog.
Re:The decline and fall of Java on the desktop by cosmotic on Wednesday March 02, 2022 @02:49PM (#30532009)
Some of those dialogs are indeed not great and a weak point. There are a few options to get a native picker though.
Re:The decline and fall of Java on the desktop by speedgoose on Wednesday March 02, 2022 @02:38PM (#30531849)
It was not impressive when this documentation was written, but it's for sure not impressive today.
Re:The decline and fall of Java on the desktop by adrian_b on Wednesday March 02, 2022 @02:56PM (#30532134)
I do not know whether the Java GUIs that I encounter from time to time are made with Swing or with other frameworks.

What I know is that since the beginning of Java and until now, on every occasion when I use for the first time some program and I am surprised that its GUI is ugly, slow and impossible to customize, then, without exception, I always discover that the GUI is written in Java.

Since around 8 years I use only 4k monitors. While on Windows I have encountered some programs which had problems on high-resolution screens, on Linux I never had any problems, except with all professional programs written in Java, which, unlike the native GUI applications, do not honor any system configurations and they do not seem aware of which is the monitor dpi, to adjust their GUI. Moreover, for some reason the programmers who write such Java programs are almost always morons who do not provide any means for changing the fonts which are used by the GUI.

Just a few months ago, I have still encountered some expensive professional programs, which used a Java GUI installer. The Java GUI installer crashed on any computer which used monitors with 10-bit color components. When investigating the problem the conclusion was that it is a well-known Java bug that had not been solved for some years and which causes such Java GUI installers to work only on low-quality monitors with 8-bit color components.

So much for the supposed benefit of Java being able to run anywhere.

Re:The decline and fall of Java on the desktop by leftbit on Wednesday March 02, 2022 @05:12PM (#30533947)
Yes, that's totally annoying since it really isn't very hard to get right... Swings layout managers are just made to deal with this stuff.
Re:The decline and fall of Java on the desktop by jcranmer on Wednesday March 02, 2022 @01:56PM (#30531265)
I will freely admit that Java Swing remains the only GUI toolkit I've used that I actually felt comfortable using to write a GUI, rather than something that feels like having to pull out teeth to get things working in a somewhat coherent manner.
Re:The decline and fall of Java on the desktop by QuercusMax on Wednesday March 02, 2022 @04:50PM (#30533697)
Absolutely agree, provided you use a layout manager that isn't brain damaged.

Anyone remember this video? https://www.youtube.com/watch?v=UuLaxbFKAcc - Totally Gridbag

Re:The decline and fall of Java on the desktop by MaxBarraclough on Thursday March 03, 2022 @08:22AM (#30540612)
I don't do a lot of GUI programming, but I always found the Swing layouting to be very frustrating and counterintuitive.

As others have said, JavaFX is really pretty good. People who use JavaFX generally seem to be satisfied, it's not often I see a substantive criticism of it, but unfortunately it seems to be widely regarded as too little too late and doesn't get given a chance. The Ada of the GUI toolkit world.

Re:The decline and fall of Java on the desktop by bigger_cheese on Wednesday March 02, 2022 @05:53PM (#30534514)
For a while I thought GTK was great hope for a good toolkit. I remember about this time period in this article (early 2000's) messing around with Perl/GTK to write simple desktop apps.

Unfortunately had issues with new version breaking backwards compatibility etc. which killed it.

QT also had similar hype but never took off.

Re:The decline and fall of Java on the desktop by bitwize on Wednesday March 02, 2022 @02:13PM (#30531498)
You haven't tried AppKit, WinForms, or WPF.
Re:The decline and fall of Java on the desktop by datavirtue on Wednesday March 02, 2022 @02:34PM (#30531799)
Winforms is dead, as in not cross platform and WPF...the same. WPF is declarative XML as is Xamarin Forms (both slightly different XML oddly). Not fun.
Re:The decline and fall of Java on the desktop by jeroenhd on Wednesday March 02, 2022 @07:53PM (#30535677)
Microsoft's refusal to port WinForms is truly the most disappointing part of its cross-platform efforts, in my opinion. They have Mono, they can get it working, they just choose not to.

I wouldn't build a production application in WinForms, WPF and friends are much better for that. But, for quick&dirty or even moderately complex tools for experts, VS + WinForms simply has no equal. Some Python-based designers come close, but they definitely suffer when it comes to distribution.

With modern dotnet tech, Microsoft could allow us to build a (rather sizable) single, statically linked binary for any architecture, with the impressive performance of the dotnet JIT and native controls.

After working on Android designs, I've got to say, XML is fine for UI design. You need previews and visual inspectors to get an accurate idea of what you're doing, but describing what control lives where and what properties it has is a perfectly sensible use case for XML.

Re:The decline and fall of Java on the desktop by kaba0 on Thursday March 03, 2022 @03:52AM (#30538725)
It wouldn’t make much sense to port Winforms any more, as it is CPU-renderer only. It would be disappointingly slow for anything more complex than, well, forms.
Re:The decline and fall of Java on the desktop by mike_hearn on Wednesday March 02, 2022 @03:54PM (#30532988)
XML is actually pretty good at declaring UI. It's the sort of thing the language was designed for - a UI is a tree of attributed nodes, and that's also what XML gives you.
Re:The decline and fall of Java on the desktop by thrower123 on Wednesday March 02, 2022 @07:56PM (#30535701)
Winforms is undead.

We'll be writing WinForms applications in the 22nd century.

Re:The decline and fall of Java on the desktop by mardifoufs on Wednesday March 02, 2022 @02:17PM (#30531552)
Interesting, I'm not aware of any Java app that truly feels or looks native. I guess that there is definitely some selection biais, but do you have any examples of native-like Java Swing apps?
Re:The decline and fall of Java on the desktop by cosmotic on Wednesday March 02, 2022 @06:53PM (#30535208)
IDEA looked near-native (aside from docking/windowing that doesn't have system L&F anywhere) before they forced users away from system L&F.
Re:The decline and fall of Java on the desktop by smrtinsert on Wednesday March 02, 2022 @08:31PM (#30535968)
SWT apps look native last time I used them.
Re:The decline and fall of Java on the desktop by datavirtue on Wednesday March 02, 2022 @02:30PM (#30531740)
It doesn't really matter. The users don't care and who the hell would want a native looking experience on windows anyway? I haven't tried my UI on a Mac recently but I doubt anyone would notice a difference. I have used Intellij IDEA on Mac recently and I appreciated the custom theme.
Re:The decline and fall of Java on the desktop by criddell on Wednesday March 02, 2022 @02:33PM (#30531783)
> who the hell would want a native looking experience on windows anyway?

I would. People who use accessibility tools that work best with native controls would as well.

Re:The decline and fall of Java on the desktop by bitwize on Wednesday March 02, 2022 @02:13PM (#30531490)
The only way to achieve native-looking and feeling apps is to use the native UI toolkit of each platform. There is no such thing as a cross-platform toolkit that doesn't introduce jank and inaccuracy.
Re:The decline and fall of Java on the desktop by ravenstine on Wednesday March 02, 2022 @02:14PM (#30531502)
Do you mean specifically for Java? The Qt framework widgets look pretty dang native on my Mac.
Re:The decline and fall of Java on the desktop by speedgoose on Wednesday March 02, 2022 @02:37PM (#30531840)
Qt applications that try to look native are a bit weird for me. They are like a counterfeit product. I prefer an Electron app with a non native look that looks good.
Re:The decline and fall of Java on the desktop by MaxBarraclough on Thursday March 03, 2022 @08:24AM (#30540641)
> Java Swing still lets you make native-looking-and-feeling apps (with some care). I don't know of any new GUI frameworks that let you do the same.

That's the whole raison d'être of the (C++) wxWidgets toolkit. [0] It fully commits to using native GUI widgets, rather than impersonating them. (That is, it wraps various other toolkits.)

As others have pointed out, the other major cross-platform toolkits (Qt, GTK) also do a pretty good job.

[0] https://wxwidgets.org/

Re:The decline and fall of Java on the desktop by scythe on Wednesday March 02, 2022 @01:57PM (#30531267)
Racket's GUI library comes pretty close, although the memory consumption needs work:

https://news.ycombinator.com/item?id=28512406