Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

My impression of Java UI components was that they looked boring and old-fashioned. It's a subjective judgement, but I guess others would have thought that way too. If Java Swing or other parts of the Java UI toolkit looked better than many native GUIs then there would have been more interest.


sort by: page size:

That's not correct. The first UI toolkit Java had was AWT and it mapped through to native widgets. AWT was not very successful because it tried to be cross platform rather than a direct mapping of the Windows UI toolkit, which was significantly more advanced in that era than its competitors MacOS Classic and - most problematically - UNIX workstations, which had truly miserable UI toolkits. So AWT was limited to the lowest common denominator and trying to abstract UI libraries didn't work very well, the abstraction was leaky.

So for the first few years of Java's existence developers were given native UI, and said no, actually, we don't care if we have a native look and feel or not - for the kinds of line-of-business apps they were writing a powerful and consistent toolkit was more important than one that looked the right shade of grey. Hence, Swing.

Nowadays if you want to write a small, pure native Java app with native widgets you can do it with SWT and Avian. There's an example here:

  https://readytalk.github.io/avian/
It demos all the features available in SWT with a 1mb download that's fully self contained. You still have the problem of leaky abstractions and SWT apps don't look entirely normal, as some more complex widgets still need to be custom, but it's another attempt at AWT that works significantly better as MacOS and Linux closed the gap with what Windows could do, so you can have a richer abstraction.

Probably part of it, but for me, the somewhat uncanny valley-ish non-standard look and behaviour of Swing UIs (and AWT before that) is the biggest turn off. Using java apps on the desktop feels a little like using a keyboard with mittens.

> java's got a UI toolkit that works out of the box for all supported environments

That's not a useful observation; JavaScript has that too.

> and ontop of that is built a fair number of UI frameworks like swing

Swing is what I was thinking of; I've never gotten the impression that anyone liked it.


I disagree, native looking applications, while "boring", at least feel natural. Every time I use an application with custom controls (which almost always look pillowy) I feel like it wasn't made by a professional, it tends to respond different and it just doesn't feel right. I have read again and again criticism against Java and how it "failed" in the desktop because every time you used a Java application, it looked like a Java application.

I've been coding Java since 1.2, mainly UI. 20 years we built a really complex control system visualizing thousands of graphical states on six monitors on a Pentium, quietly ticking away at 20% CPU usage... all in Swing. Which I still find very impressive.

Swing suffered from two central weaknesses: the tutorials provided by Oracle were... often insufficient. And you could pick up some bad habits by following them. And then there were the UI builders where anybody could draw up something mediocre.

Real strength were the lightweight components where you could about change everything in your Look&Feel. Hexagonal radiobuttons? No problem. Want the drop down button of that combobox a bit larger? There you go.

SWT... wouldn't really categorize that as an UI toolkit. SWT is mainly driven by eclipse, not developed independently. All controls commonly used by eclipse run reasonably well. Using anything else, especially cross platform is risky. 2D graphics is especially slow. So it's only a reasonable choice if you want to build something that looks and behaves like eclipse. There's some styling of components via CSS, but it's not complete...


I feel the same way. I was writing a desktop Windows/Mac app using swing 10 years ago. The look and feel that came out of the box was fine. At first it was metal. It was a light blue with gradients to white on the buttons. Then they came out with Nimbus - I think that one was based on SVG or something similar.

No client complained about either of those. And at the end of the day you could always call a method to get the platform look and feel and it could look like Windows or Mac OS. I had a menu to change this in the app itself.

I never found the UI development hard. I was hand coding it in the beginning. I thought the Layouts were pretty straight forward (except grid bag which I never used). Eventually NetBeans had a decent UI designer and I used that.

I think the sloppy or slow UI's came from developers who never took advantage of the Observable / MVC aspects of the UI components.


UIs though...

I haven't worked with a single Java based GUI application that did feel smooth, fast and efficient.

I wonder why that is.


I agree somewhat with btip. The UI features of Java were not only ugly, but, until 6.0, slow. This is one of the reasons Eclipse uses SWT rather than native Swing.

6 brought with it a much faster UI experience. Unfortunately that happened after the transition of apps from the desktop to the web. So you had slow applet downloads vs Flash on the client. You also had compatibility issues that were more involved than Flash.

Finally, other cross platform frame works like Qt came along. Now you'd get closer native appearance with languages other than Java.

As a result of the confluence of events and changes Java became relegated to server or phone side.


Sure, the problem is - Java apps did neither.

Looking good? The default Swing metal theme was truly awful. It was possible to switch to Windows-like theme, but it was even more awful - it had plenty of visual glitches and things misplaced by a few pixels it couldn't even use the native file selector window.

Working well? Startup times and performance was terrible compared to native apps, and memory usage is still abysmal. And you got occasional GC pauses even in well optimised apps. I still sometimes run into occasional lags in Idea, even though Jetbrains did a lot of great work to polish the user experience.

Doing what they want? That depends on the programmer, but, besides developer utilities like IDEs, I can't think of a Java app that didn't have a better looking and more polished native competition.


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.


I worked on Java apps around that timeframe. Despite spending a lot of effort refining our widgets and using some animated transitions (ref the "Filthy Rich Clients" book) the applications generally felt more dated and cheaper-looking than native apps.

For enterprise apps with no strong competitors these minor aesthetic issues didn't impact revenue so those UIs remained in Java. But for everything else it was worth it (financially) to migrate to native.

I sometimes armchair quarterback and wonder whether Java would have been more successful if the Swing folks had focused more on design. It seemed like the most they ever did UI wise was attempt to catch up to platform native widgets so they were perpetually several years out of date and slightly inconsistent. Had they skated to where the puck was going to be rather than where it is perhaps Java applications would be the ones people pointed to when asking devs to "make it look sexy" instead of iTunes.


I think the issue with Swing was that is was in a bit of an uncanny valley. If all controls were custom it wouldn't look strange.

Visual Basic was very... well, "basic", so it looked normal. Some tools like CCleaner and a lot of Antiviruses had fully custom looks, but didn't look out of place, because they were too different.

JavaFX looks fine, though.


Can you supply an example? I gave up on Java GUI over 20 years ago because it looked horrible.

I have used Swing a bit more than the author of the article did, and it really took Sun way to long to improve upon it. Before Java 6 it had some noticeable gaps and the performance was rather bad. But since then it's not that bad in that regard, you'll even get your System Tray icons (Sun used to be _very_ conservative about that. If it's not available everywhere, no soup for you.)

And any GUI toolkit is complex. Often this is hidden behind IDE boilerplate code or GUI builders, but it's there. Once you get the hang of Swing, you're able to adapt it to your liking a lot (event handling, custom UI elements etc.). I still remember early X11 toolkits that appeared to be easy, but once you went beyond their boundaries, it was "drop down to Xlib" time.

Regarding the look and feel: Strangely enough the one platform that cares the least about that is Windows. Yes, the old Metal L&F sticks out, but once you stick to the system colors, any differences vanish. The typical user probably already uses lots of so-called native apps that look differently, as every Office release has new kinds of toolbar buttons etc, there's still apps out with huge check marks and crosses on their OK/Cancel buttons etc. The main issue I had with Swing here was getting the "feel" okay, i.e. drag-and-drop, shortcuts, the behavior of tree elements...

Of course, on Mac, everything that isn't done in Cocoa looks and feels alien. It's possible to get rather close with Swing and Qt, but it takes a lot of effort.


"Beauty" it not a word I've ever heard associated with Java GUIs before. From browsing screenshots Swing looks to me like non-native 1990s clunkiness. Am I missing something?

I cringe every time I have to make a Swing GUI for Java projects at my uni. It might just be me, but I can never get them to look half decent.

Uglier is relative, but I will give you that neither unthemed Swing or JavaFX are too fine looking.

But I would say that e.g. IntelliJ looks quite good and that is a basic theme available without much tweaking, plus it can be very snappy (when jetbrains doesn’t ship it with a decade old JVM with shitty default settings. It is fixed in recent versions).


I think Java was almost killed by not having native look and feel in Swing. There is probably still a lot more desktop applications written with native Windows look and feel than with Qt or Java. It is still a problem with mobile apps that users can feel confused over some gui's that are made with html+css (or something else) and does not follow the native look and feel for the platform in question. It will probably get better over time but it has been an obstacle for many, many years.

If I wanted bloated UIs that look the same on every platform but integrate poorly with every platform I'd use Java Swing.
next

Legal | privacy