News for hackers. Stuff that matters.
Re:Graphics for JVM by cashewchoo on Tuesday November 17, 2020 @10:05AM (#25124513)
I have a long history with Swing and as painful as it is to use sometimes (e.g. "There are Swing developers with low pain tolerances?") it's astonishing how productive Swing feels compared to React even so many years later. Maybe I'm just warped but GridBagLayout, while containing a certain base level of frustration, is O(1) for frustration. Whereas CSS are absolutely O(n) or worse. One of the best feelings in the world is replacing a complicated nesting of buggy BorderLayouts et al with one nice (slightly verbose) GridBagLayout that actually works.

In my imaginary company that I own where we all run linux laptops that are managed by puppet or something, I think we might make a strong case for building many internal tools in Swing.

The biggest hurdle I see nowadays to using Swing is all about distribution: both of the jvm and the program. Imo that's really where the web won - certainly not because of its dev productivity. So it's definitely a no-go for your actual software product.... but for internal tools where you have a lot more leverage over the environment, I think it looks extremely attractive.

Regarding JavaFX... Honestly, I really like it. I have a personal project that was originally in Swing and I ported it to JavaFX because HiDPI is in a lot better shape there (though I think Swing has since figured it out?). And it's a lot better in many ways. I love-love-love using SceneBuilder for designing the view layer and the Observable pattern, I think, yields a lot of nice QOL/verbosity-reducing things.

That said, I think it did have a slightly higher O() for frustration than Swing's O(1). And I think the community, as a whole, just understands it less (less prior art etc).

So if someone said "build a usable high-quality GUI asap or you die" to me, I'd go to Swing immediately.

Re:Graphics for JVM by manishsharan on Tuesday November 17, 2020 @10:37AM (#25124958)
Ahh ! Gridbaglayout! I hated it so much ! Then I had to work with CSS and JS and I began to realize the genius of the Gridbaglayout!
Re:Graphics for JVM by jfim on Tuesday November 17, 2020 @05:29PM (#25130784)
I'd strongly recommend looking at miglayout [0] if you have to do another UI in Swing (haven't tried it with JFX). It's pretty much the best layout library I've seen, bar none, for developing UIs in Swing. You can think of it of GridBagLayout on steroids, and it even handles things like reordering buttons on a per platform basis (eg. Ok and Cancel on a dialog are in Ok/Cancel order on Windows, Cancel/Ok on Mac).

[0] http://miglayout.com

Re:Graphics for JVM by t0astbread on Tuesday November 17, 2020 @11:52PM (#25133336)
The link seems to be broken in some way. The page I'm getting is unrelated to miglayout.
Re:Graphics for JVM by specialist on Tuesday November 17, 2020 @10:15AM (#25124640)
My buddy worked on a niche volumetric (voxel) renderer for ages. I helped with some of the OpenGL bindings and plumbing.

Java Web Start (JNLP) worked great. It just worked. His customers loved him.

I've always wondered why something like desktop JNLP didn't happen.

Re:Graphics for JVM by gorjusborg on Tuesday November 17, 2020 @10:53AM (#25125181)
I owned development of a JNLP app around a decade ago.

JNLP did a good job of solving the app distribution/update problem, but required that you already had the JRE installed. Not too much different from assuming a browser is installed, but I found it much less likely that a user would take the initiative to install a JRE than a browser. They just don't understand what they are doing or why in the case of the language runtime.

That said, it did work very well, in my experience.

Re:Graphics for JVM by monknomo on Tuesday November 17, 2020 @01:18PM (#25127404)
I'll echo this. I owned a jnlp app, and most of the support we had was around walking people through installing a sufficiently correct jre. Not always easy to do that
Re:Graphics for JVM by nitrogen on Tuesday November 17, 2020 @03:52PM (#25129664)
When I was developing a Swing app, I ended up just distributing an NSIS installer that would automatically download and run the JRE installer if Java was old or missing, for that reason.
Re:Graphics for JVM by specialist on Wednesday November 18, 2020 @03:10PM (#25141794)
I would have bet money the JNLP installer did this. But I'm probably remembering wrong and will defer to the collective wisdom of the hive.
Re:Graphics for JVM by monknomo on Friday November 20, 2020 @11:28AM (#25161962)
I am about 90% sure there was some sort of 3rd party open-source wrapper that would download a jre. But I cannot remember what it might have been called
Re:Graphics for JVM by coliveira on Tuesday November 17, 2020 @05:34PM (#25130838)
Why apps don't just install a copy of the JRE (I believe it is redistributable).
Re:Graphics for JVM by monknomo on Friday November 20, 2020 @11:27AM (#25161944)
When you're distributing a real installer with a swing app, including a copy of the JRE is definitely the thing to do.

A jnlp app is a file format that defines how to launch a java executable over the internet. It defines the location where the executable is, and what version of java is required. Opening the jnlp to download and launching the app requires an installed JRE, or there is nothing to interpret the jnlp and go get the application.

There is, iirc, a utility that will wrap a jnlp file and go get a jre. I forget what it's called, but it makes jnlp apps more like an auto-updating standard app.

The benefit of the jnlp approach is if you can guarantee your users have java installed, then they don't need to install your app. Just click a link, then a java app self-downloads, installs and sets up a shortcut on the desktop. And it updates whenever they open it and a new version is detected.

Re:Graphics for JVM by goatinaboat on Tuesday November 17, 2020 @02:23PM (#25128387)
I've always wondered why something like desktop JNLP didn't happen.

Wasn’t that Marimba/Castanet?

https://www.wired.com/1996/11/es-marimba/

Re:Graphics for JVM by oezi on Tuesday November 17, 2020 @05:13PM (#25130630)
It failed because,...

A.) ...they never figured out a good/unobtrusive update process for the JVM itself.

B.)...Sun faltered when they picked up steam. (Remember when IBM threw 1 billion USD at writing Eclipse in Java?)

Re:Graphics for JVM by cocoa19 on Tuesday November 17, 2020 @05:49PM (#25130983)
And Eclipse was hands down the best tool for Java development... Until it was left to rot, and JetBrains came along.
Re:Graphics for JVM by spelunker on Tuesday November 17, 2020 @10:50AM (#25125133)
GridBagLayout... haven't heard that one in a while. After dealing with CSS madness for years perhaps I should give it a try again.
Re:Graphics for JVM by mmm_grayons on Tuesday November 17, 2020 @10:56AM (#25125220)
> I think swing has since figured [HiDPI] out

I hear Java GUI has supposedly gotten better, but all of the Java GUI apps I see look awful. For instance, try telling that to Ghidra and it's butt-ugly text that shows up super thin on my hidpi display. I like Ghidra, but for a graphical RE tool, Cutter is so much prettier with its QT interface. Of course, r2 is great and works from CLI.

Re:Graphics for JVM by spullara on Tuesday November 17, 2020 @02:39PM (#25128596)
JetBrains products are all Java GUI apps and people love them. Depends on the team building it more than the technology.
Re:Graphics for JVM by patrec on Tuesday November 17, 2020 @04:34PM (#25130198)
I say that some who likes Jetbrains and buys their products:

No one in his right mind loves the UI of Jetbrains Apps and the Linux experience has always been a shitshow unless you were using Gnome or KDE. Because Swing does not implement the XWindows protocol properly. So yeah, a great team can still make a functional app with terrible GUI technology -- but there is a world of a difference to something that's really polished, fast and enjoyable to use.

Re:Graphics for JVM by ClumsyPilot on Tuesday November 17, 2020 @04:42PM (#25130297)
I think IntelliJ has the best UI of all IDEs I've seen, it sure as hell beats Visual Studio (the paid one), it beats Netbeans, Eclipse.. What else?

VsCode and atom are simpler, but they just don't provide UI, for many setting you have to go to config files, and some functionality is missing outright.

Can you think of an IDE with better UX?

Re:Graphics for JVM by patrec on Tuesday November 17, 2020 @07:08PM (#25131588)
Jetbrains products are my preferred choice for full-featured IDEs, but this is not exactly an industry renowned for producing snappy and pleasing interfaces. And since LSP has narrowed the gap, most of the time I don't require the features that would make up for the bad UX so the majority of my coding happens outside an IDE.
Re:Graphics for JVM by AlchemistCamp on Tuesday November 17, 2020 @06:00PM (#25131077)
MacVim is my favorite when it comes to UX. It starts instantly and stays fast even on huge files. It's very customizable and works exactly how I want, including the layout of nested horizontal and vertical split panes.

I like being able to configure just about everything in just a single config file, but still getting an additional escape hatch for overriding OS default keybindings I want to use.

Re:Graphics for JVM by ptx on Tuesday November 17, 2020 @05:23PM (#25130714)
People love IntelliJ despite Swing because its other qualities make up for the slightly off-looking Swing font rendering, the glitching Swing layout redrawing and the glitching Swing window focus.

Also, the menu bar in IntelliJ was reimplemented from scratch to make it work properly. The Swing menu bar would have been unusable with its broken handling of submenus.

Re:Graphics for JVM by naikrovek on Tuesday November 17, 2020 @04:29PM (#25130127)
But they're ugly and impossible to use, for some of us. Just awful and horrible UI and flow... I simply do not get the love for IntelliJ anything.
Re:Graphics for JVM by coliveira on Tuesday November 17, 2020 @07:14PM (#25131629)
Agreed, the only thing going for IntelliJ is that its easier to use than Eclipse, but the product is still too complex and ugly.
Re:Graphics for JVM by naikrovek on Wednesday November 18, 2020 @01:55AM (#25133910)
Really? I love eclipse. Though not as much as I used to.

I suppose preferences here are at least partially determined by how you think about software project management. Eclipse makes perfect sense to me, and has since the first day I used it. IntelliJ is obtuse and odd and ... wrong to me.

Re:Graphics for JVM by coliveira on Wednesday November 18, 2020 @02:16AM (#25134022)
I agree that Eclipse is better than IntelliJ, but is not as easy to use. But after you get used, Eclipse is a better product.
Re:Graphics for JVM by scns on Tuesday November 17, 2020 @12:29PM (#25126582)
Take a look at Bitwig
Re:Graphics for JVM by Rebelgecko on Tuesday November 17, 2020 @02:08PM (#25128176)
JavaFX also has much better emoji support IIRC
Re:Graphics for JVM by monknomo on Tuesday November 17, 2020 @01:14PM (#25127338)
I am right there with you on gridbaglayout. And tools like WindowBuilder make it so fast to generate basically acceptable guis
Re:Graphics for JVM by naikrovek on Tuesday November 17, 2020 @04:27PM (#25130108)
"basically acceptable" is such a low bar.
Re:Graphics for JVM by FollowSteph3 on Tuesday November 17, 2020 @01:37PM (#25127701)
For distribution check out Install4J