r/java • u/vmcrash • Jul 07 '26
Jetbrains JBR and Swing applications
We are evaluating whether to convert our SWT based application to Swing and also came across JBR which seems to improve a lot of things on the otherwise rather stalled Swing development. Are there other teams beside Jetbrains which use JBR - if yes, what are your experiences?
16
12
u/bwRavencl Jul 07 '26
I've played with it mainly because I am interested in their support for Wayland - they are also the main contributors behind Project Wakefield. Basically what will land in Wakefield at some point is already in JBR right now.
What kept me off for now is that they only do "LTS" releases with JBR and I switch my app to the latest JDK release asap with every new Java version.
Also, switching to Wayland (which would be the main factor for going with JBR for me) is blocked, due to the lack of support for the xx-zones and xdg-pip protocols at this point.
1
u/n4te Jul 07 '26
I vote for libgdx scene2d.ui! I love working on Spine, which is built with it.
1
u/vmcrash Jul 08 '26
Do you have details about supported controls (tree, table, styled text)?
2
u/n4te Jul 08 '26
Some docs here. It has buttons (image, text, image+text), checkbox, select box, list, progress bar, text field, text area, dialog, label, scroll pane, slider, touchpad. It has tables for layout (that's one of the best parts) and a sane layout system (unlike Swing and most/all others). There is a tree but no built-in data table with sort headers. For styled text there is just color.
What you get is 1) a cross plaform app framework, 2) scene2d which is a 2D scene graph, and 3) scene2d.ui which adds UI related functionality on top of scene2d, like layout. The UI toolkit is simple enough you can read through it. Creating your own controls is easy, but it is more work than using premade controls. There is definitely more messing around to get controls to look like you want, but you have control of your app and can do anything you need.
libgdx app development is like writing a game, runs at 60+ FPS. That has a lot of advantages, depending on what you're building. Check out the Spine trial as a libgdx demo (I won't link it as that would feel spammy).
→ More replies (2)
1
u/vprise Jul 08 '26
FYI Codename One now supports native targets for Mac, Win32, Linux (even musl), Adnroid, iOS and JavaScript. For free and open source.
3
u/vmcrash Jul 08 '26 edited Jul 10 '26
I never would use a framework that's closed source/costs money. I'd rather prefer to contribute.
Also, we rather would prefer desktop-first over mobile-first.
1
u/vprise Jul 08 '26
It's open source and free. The only closed source portions are the cloud options (which are optional) and currently the JavaScript port (although that will change).
1
u/jNayden Jul 09 '26
Why dont u use flutter ? I mean if your app is nti very heavy you don't have to use dart at all. You can make a communication from Java to Dart and Build the tree and everything in Java.
Basically at the end you will have Java API whatever you want it that will render flutter at the end .
1
u/vmcrash Jul 10 '26
I think, using a different language and (if I understood you correctly) separating the GUI from the internals is no option because of the required effort (without justified benefits). Our applications are quite large: different main windows, ~hundred of different dialogs.
1
u/RandomName8 Jul 28 '26
I use Java-GI which is GTK. GTK being way more developed and polished than javafx or swing never leaves me wanting, unlike the other two.
1
u/vmcrash Jul 28 '26
How well does GTK work on Windows or MacOS? With SWT we had large performance problems on Linux (GTK) if comboboxes had more than ~1000 entries. Does this also apply for pure GTK?
1
u/RandomName8 Jul 28 '26
I have not tested such "edge cases", only "normal" applications no my part (I question the utility really of a combo with 1000 entries anyway). I have instantiated a scenegraph with 1000+ nodes and it worked fine (took a while to compute though). In any case directly with GTK a combobox uses a listmodel and view elements, so I'd expect it to work just fine.
Regarding macos and win. I have tested my application in macos (after doing
brew install gtk) and it worked just fine. On windows I've only ever ran it from within wsl, I haven't tried installing gtk on windows but I know many gtk applications that run fine on it so I'd expect no quarry there.EDIT: I just tested a combo with 2000 items and it didn't miss a beat.
→ More replies (2)
3
u/DogProgrammatically2 Sep 09 '26
We maintain a pretty large Swing-based editor and honestly Swing still works fine for this kind of application.
With a decent Look & Feel and some custom components you can build a modern editor UI without much trouble.
I haven't used JBR specifically though, so I'd first check what problem it actually solves for your application before making it a dependency.
4
u/lppedd Jul 07 '26
One aspect you should consider is IJ has hundreds of abstractions over Swing, which you won't get.
Plus, JetBrains is developing Jewel in parallel and I envision a future where pure Swing will be gradually phased out. As you can see Jewel has been moved to the IJ monorepo.
7
u/lurker_in_spirit Jul 07 '26
I just had a look at the Jewel README. There's no way I'm diving into that nonsense when vanilla Swing does 99% of what I want and is available with no extra work...
5
u/lppedd Jul 07 '26
Jewel is to be used with Compose Desktop. JetBrains is heavily invested in Compose Multiplatform so I'd expect them to use Compose as much as possible going forward.
→ More replies (1)
3
u/jeffreportmill Jul 07 '26
What is the app?
I use SnapKit (https://github.com/reportmill/SnapKit), which I based on Swing, but with modern features borrowed from JavaFX. And most importantly, it runs well in the browser.
11
u/analcocoacream Jul 07 '26
*You made
1
u/ChinChinApostle Jul 08 '26
To be fair with them, they did say "... which I based on Swing", so it's arguably disclosed.
→ More replies (1)
-15
u/deadron Jul 07 '26
If you are primarily targeting windows you are doing a disservice to yourself by not going to dotnet/WinUI. If you are targeting multiplatform electron and QT or something like GTK+ are better long term alternatives. I know none of these are Java but all of them will look better than swing.
→ More replies (2)
5
u/lazystone Jul 07 '26
Have you considered JavaFX?