News for hackers. Stuff that matters.
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by jmyeet on Thursday March 24, 2022 @10:46AM (#30790609)
The problem with all these desktop UI toolkits is they have a look and feel all of their own (IMHO). You can make buttons look like Windows buttons on Windows and OSX buttons on OSX but that's only superficially cross-platform.

Different OSs have different norms, expectations and design languages.

What I'd like to see is something that abstracts as much as it can but still allows you to make something look like a native app on that platform. That would mean you'd need to do some programming for each platform but honestly I don't think there's a good way around that.

The solution isn't Electron. Way too heavyweight. Wayy too resource intensive. Way too risky by having a huge attack surface.

An additiojnal problem with Java is bundling such an app. Requiring a JRE on a target platfrom is (IMHO) a big problem. They're far from universal now. Something that compiles to a static binary. There have been efforts to create self-contained standalone packaging for Java applications. My understanding (which may be incorrect) is that all of these solutions are still somewhat suboptimal.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by potatolicious on Thursday March 24, 2022 @12:32PM (#30792172)
I'll take the opposite side of this having been doing cross-platform dev for a really long time: you will never successfully achieve a cross-platform GUI platform that is so successful at emulating the native platform that users can't tell the difference.

You can try pursuing it, but it is a field littered with the dead project before you that have tried the same thing. Xamarin, Flutter, Qt, React Native, the list goes on. Some of these projects are mostly-dead, others are heavily used but no user is actually fooled.

I would propose something different: for Java to develop their own design language, which has "good enough" native platform integration but otherwise doesn't try to pretend. Cross-platform platform users generally belong into two camps:

- Ok with something that appears visibly different from true native apps, but the cost savings are worth it and the users don't care so much about native-feeling-ness.

- Under the expectation that their cross-platform app will be so good that it is totally indistinguishable from a true platform-native app.

My contention is that Java (and other xplat projects) should focus on the first group; the second group is not worth serving because it has always failed, and will always fail.

The problem with the state of Java GUI development isn't so much that it fails to emulate the native platform GUI sufficiently, it's that it's ugly and janky. Improving it should be the goal.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by jjtheblunt on Thursday March 24, 2022 @02:46PM (#30793847)
> for Java to develop their own design language

JavaFX is not that?

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by 7steps2much on Thursday March 24, 2022 @04:24PM (#30794922)
There was swing before that as well!
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by jjtheblunt on Thursday March 24, 2022 @05:44PM (#30795694)
AWT before Swing, too, and it worked really well back when there were green threads (comparable it seems to the return of userspace threads in Project Loom?).
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by warning26 on Thursday March 24, 2022 @12:18PM (#30791991)
> The problem with all these desktop UI toolkits is they have a look and feel all of their own (IMHO). You can make buttons look like Windows buttons on Windows and OSX buttons on OSX but that's only superficially cross-platform.

Exactly this -- every cross platform GUI toolkit ends up falling into an uncanny valley where it looks sort of native but subtle things are just off.

This is, I think, a key part of Electron's popularity. Apps made with Electron are so very obviously non-native that they avoid this uncanny valley effect.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by Macha on Thursday March 24, 2022 @01:12PM (#30792698)
Also for desktop apps, Windows is such an inconsistent mess that who knows what's native anymore, and that is the largest platform from a visual point of view, while at least electron doesn't get in your way from an integration and accessibility point of view
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by Cthulhu_ on Thursday March 24, 2022 @12:08PM (#30791833)
Here's a novel approach: Build native applications / user interfaces. Time gained from using cross-platform libraries is negated by all the issues it creates.

It's better to have one developer per platform, than two (or more!) working on a cross-platform application. And you get true native applications; think of things like accessibility options, which are often overlooked in cross-platform toolkits, or performance.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by tonyedgecombe on Thursday March 24, 2022 @12:28PM (#30792129)
Fork is a great example of that from a two person team. It really isn't that difficult nor expensive.

https://git-fork.com

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by rhysmorgan on Thursday March 24, 2022 @12:44PM (#30792341)
Could not agree more. Users don't need to be "fooled" by an uncanny-valley, years-out-of-date looking simulacrum of native UI, because they're getting the real deal. Accessibility is so overlooked, while some native UI toolkits provide at least a passable default accessibility implementation.
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by amelius on Thursday March 24, 2022 @11:36AM (#30791355)
> You can make buttons look like Windows buttons on Windows and OSX buttons on OSX but that's only superficially cross-platform.

Sorry, but the problems you are talking about are first-world problems imho. If the button looks like a button, and clicks like a button, what is the problem really?

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by stefs on Thursday March 24, 2022 @12:20PM (#30792005)
the problem used to be very visible in early app development: you get android apps that try to imitate ios. the navigation is wrong, the inputs are wrong, the ui language is inconsistent.

it happened all the time when almost all of the graphic designers (which were thrust into the roles of UI designers) were on mac and usually ios but got the task of "designing an app", which meant _one_ design for both ios and android. as an android developer i had to fight the OS, the framework and pretty much everything else to make the designers vision work, which resulted in buggy apps that felt unintuitive to use.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by amelius on Thursday March 24, 2022 @12:29PM (#30792141)
The Web has had buttons that are inconsistent with the native OS for ages, yet users never really complained.

E.g. visit https://twitter.com/ and select Sign-up. I don't know what OS you are on, but the sign-up box probably doesn't look native. Users accept this. So what is the problem, really?

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by shantnutiwari on Thursday March 24, 2022 @12:17PM (#30791978)
Yeah, people complain about UI not looking "native", but other than UI experts, does anyone care? Do the end users care?
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by stefs on Thursday March 24, 2022 @12:23PM (#30792054)
that's not what they were arguing tho: "You can make buttons look like Windows buttons on Windows and OSX buttons on OSX but that's only superficially cross-platform."

platform design choices are much more than the look of a button. it's choice and arrangement of ui elements, navigation systems, metaphors, ...

if you just see it as "button on windows" vs. "button on macos" it's not that obvious, but think about how you'd design an email client on windows vs. command line vs. mobile phone vs. smart watch.

a simple "button" might be roughly the same on every platform, but the overall design would be quite different.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by thfuran on Thursday March 24, 2022 @09:57PM (#30797894)
The problem is that any GUI for a not-completely-trivial application is going to consist of much more than a single isolated button and the way that a GUI is expected to behave and be structured is not the same across all platforms so no matter how carefully you mimic the appearance of the buttons, an app that behaves the same onall platforms cannot behave like a native app on all platforms.
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by thatjoeoverthr on Thursday March 24, 2022 @12:42PM (#30792311)
I’m surprised this is still a complaint, for two reasons. First, many major apps don’t bother having a native look and instead have their own skins. Second, Windows is such a mess that it no longer has an obvious standard look and feel anymore. This has been shown here recently screenshots. Microsoft’s own products, when not using custom skins, are using any of several “native” toolkits with their own aesthetics. None of them are particularly interesting so if it isn’t for consistency, there isn’t a strong reason to imitate any of them.
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by hackerfromthefu on Thursday March 24, 2022 @09:07PM (#30797620)
Yeah Windows has really shot the pooch this last decade.

It used to be so consistent and poweruser friendly.

Windows 11 has just broken a lot of the poweruser keyboard shortcuts for doing things, on top of all their ads, nagware, telemetry/stalking and various antifeatures, it's like they are begging power users to go to Linux.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by kitsunesoba on Thursday March 24, 2022 @01:02PM (#30792575)
> What I'd like to see is something that abstracts as much as it can but still allows you to make something look like a native app on that platform.

Yes, I’ve long thought this as well.

I think it’ll take an entirely different approach than cross platform UI libraries typically take — rather than implementing widgets itself, it would have the developer provide a somewhat loose “UI spec” document that then gets compiled into a UI befitting each target platform. Not only widget appearances and behaviors would vary between platforms, but also window layouts. The only exception to the rule of not implementing widgets itself would be where one platform lacks a widget to avoid least common denominator problems (for example, WinUI and GTK have nothing resembling Cocoa’s miller column NSBrowser control, so those platforms would get an implementation of that view built from other native controls).

It wouldn’t fit every use case since it wouldn’t provide down-to-the-pixel control but it would work for a lot of software.

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by chopin on Thursday March 24, 2022 @12:10PM (#30791867)
> The problem with all these desktop UI toolkits is they have a look and feel all of their own (IMHO). You can make buttons look like Windows buttons on Windows and OSX buttons on OSX but that's only superficially cross-platform.

SWT (the UI library which drives Eclipse) would give you that on Windows, OSX and Linux. But it's not exactly light-weight...

Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by warning26 on Thursday March 24, 2022 @12:20PM (#30792004)
SWT still doesn't really feel native though. The toolbars, in particular, look like they belong in Office XP.
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by funcDropShadow on Thursday March 24, 2022 @11:06AM (#30790915)
There is jpackage in the JDK, which can build native packages for Window, macOS, and Linux. There is GraalVM which can create native binaries.
Re:Ask HN: Does Java need a modern Java UI toolkit for deskt... by JulianMorrison on Thursday March 24, 2022 @11:12AM (#30791013)
If I had a do-over on Java, I'd get them to make separate interface toolkits for each major platform. Ones that use the native widgets and follow the native conventions. Design them to feel as similar to program as possible, within that limitation. Share stuff that can be shared, but don't force it if it's not as similar as it looks.

Then after that maybe add a cross-platform toolkit that doesn't try to look or feel local, but treat that as a peer with the other UI kits, not a replacement.