JavaOne day three: Native looking swing UIs

Given my abysmal track record with regards to session attendance, I thought that today I’d make an effort to go to more than one. The first of these was the ‘how to make Swing look native and great’ session. So so much of this session resonated with me, and I ended up feeling very angry and bitter at all the developers out there who have such a callous disregard for such basic elements of UI design.

I mean really, it takes SO LITTLE to put yourself in the mind of your end user, and imagine what they feel when confronted with your UI. What are they trying to achieve? Are you helping or hindering? Are you wasting your time on hidden features that the UI does not advertise? Are you writing your UI to your code, or to your user’s needs? These mistakes are frightfully common. Just look at roller (granted, it’s a web UI, but the same principles apply). The whole thing seems to deliberately go out of its way to spite its users and deliver a painful and inconsiderate UI. The same thing applies to site after site after app after app.

One of the key take home lessons from the session too that all the assholes who demand 100% native looking/behaving apps with no effort on their part are ignorant asshats. Swing will do 80% of the work for you. The rest is up to you. Yes, amazingly, you DO need to know the UI guidelines of your target platform. Yes, you DO need to test using multiple platforms. If you don’t, you end up with shit like Eclipse, which, through the divine gift of obstinate fuckwittedness, behaves like a Windows application no matter what platform you run it on. If your UI is successful and usable, the best outcome is no feedback from your end users. They’ll be suffused with a happyhappy feeling and won’t quite know why. They’ll eagerly use your application and not cringe when they’re asked to do something with it.

On the downside, when you have a bad UI, very very few users will be able to pinpoint what is so bad about it. Instead, they’ll hate your application and feel an incoherent rage towards anyone insisting they use it. It’s not like web shit where there are a few million html monkeys and two ways of doing everything; with rich clients, there are thousands of ways of doing everything, and about 3 people who know the right way. Finding the sweet spot is a task far more daunting than farting out yet another silly web intranet app.

Conclusion? The user drives the UI and features, NOT the underlying code. It’s your responsibility as a developer to ensure that the mapping between your UI and your underlying functionality works well, and to acknowledge that such a mapping is necessary. Also, always always go that extra mile to ensure that your app is well behaved on all platforms, and be prepared to spend a lot of time and effort doing that with no feedback. No feedback that is beyond smiley gleeful users who are more often than not totally unable to attribute that sensual sense of satisfaction with anything you might have done.

38 Responses to “JavaOne day three: Native looking swing UIs”

  1. Tiago Silveira and the world Says:

    [Trackback] There’s a really good point in this post at the Bile Blog. Swing will not look native unless you put yourself to work.

    The reason why we have so much poor clients is that designing GUIs is not easy. And quoting Hani, “it’s your responsibility as…

  2. Simon Smith Says:

    Wow! Minimum bile and a really good point! Much more of this and you’ll be ‘respectable’.

  3. Anonymous Says:

    I *like* it that Eclipse behaves like a Windows application no matter which platform I run it on.

    BTW, how is a Linux application supposed to behave? I’ve never seen enough consistency to generalize from.

  4. S. Gersmann Says:

    Nice one - but missing the point.
    Various issues regarding Swing have been fixed by independend developers. The major flaw Swing has at the moment is that it is absolutely unusable on LCD screens becaus of its crappy font rasterizer. Every major platform now supports subpixel hinting. This is a issue that cannot be fixed by independent Java developers. A RFE has been signed in 2002 ( http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4726365) and nothing happened so far.

    This makes Swing absolutley unacceptable as desktop application platform. All we got with Tiger is some antialiasing which makes things even worse. This is in my humble opinion one of the reasons developers are moving towards .NET and SWT.

  5. Shai Says:

    Steve,
    first people complained about anti-aliasing (which was there since 1.3 but was not turned on by default). Now its sub pixel hinting that only shows on LCD screens???
    I agree that there is an issue that should be fixed, but I think its a huge leap to claim the platform unusable!
    Most people don’t notice the difference when I turn on anti-aliasing in front of them (that is change the setting on the fly so they will see the difference).

  6. S. Gersmann Says:

    I agree that this problem is specific - but it is specific to a growing number of hardware platforms. This issue is annoying on usual LCDs but it is a serious problem on high-resolution notebook displays (I’m talking about 1400*1050 at 14″ here).

    It renders NetBeans - which I personally like - useless. Maybe I’m blind, but this type of hardware is getting very common. Maybe I should donate a few notebooks to the Java Swing team if I only could afford.

    Regards, Steve
    (Btw, it would be nice to get some more votes on this bug/RFE)

  7. Davide Inglima - limaCAT Says:

    Steve: you are bashing a “small problem” in order to demolish a “bigger one”, not counting that you are not counter-evaluating all the problems introduced by your solutions.

    For starters:

    - .NET is not Java, and GTK+/QT are not Java, they are entirely different beasts with a different market and reasons for adopting them, whatever GTK+ zealots may say.

    - SWT adds unneeded layers of complexity in releasing an application, just ask MIT and their Haystack software, and look instead at how ant, jboss, tomcat and netbeans are succesfully deployed on multiple platforms.

    - SWT also defeats the purpose of having Java, and on a p3 with 500 mhzs you don’t notice the difference in suckiness of the slow eclipse against the suckiness of the slow netbeans, they are two unmovable mastodons.

    I agree that you are terribly correct for subpixel hinting and stuff, but it is not THE reason why the market is moving to dotnet or to swt. Market is moving to .NET only because the market already knows (and trust Microsoft for revenues, as it is TODAY umm… a market with 90%+ desktop share) and C# looks like C++ (which market already knows), and on the other hand is SLOWLY moving to SWT only because SWT seems easier to program in (that is: it does not have all those patterns thrown between the legs of the programmers… using Swing sometimes is like using a spaceship to go to a grocery store).

    But knowing good Java and good Swing and creating 1 solid, -> WORA <- appliation is still waaaaaaaaay better than knowing mediocre Java and crapping 5 new SWT applications a day, or maybe the eclipse plugin of the week.

  8. Tiago Silveira Says:

    Well, I guess you’re all missing the point. A native UI means that it looks like the system UI. Windows look like system windows, mouse pointer look like mouse pointers and buttons look like buttons. OSes with GUI interfaces have a standard look and feel: if a thingy looks like an icon, it should also behave like an icon. In M$-Windows, this means that you should be able to select it, double-clike it, right-click it, move it around, etc. And this is why you have to know your target system, even if you’re coding with Swing.

    Some window managers in Linux allow you to configure what kind of OS event corresponds to what kind of GUI-Events. It can be that double-click in the title bar minimizes, it, and in this case, your Java app should behave exactly like this.

    All this assumes that you want a native look and feel, of course.

  9. S. Gersmann Says:

    Well Davide, I didn’t want to say that I suppose SWT or .NET to be superior. But in the end it is possile to build usable applications with them. I don’t dislike Swing and at least of all Swings performance. I believe that Swing is incredible fast. But it’s the small things that matter and make an application a good application.

    You can’t tell the users (and thats what I belive Hani’s posting was about): “I’m sorry that you are getting headaches from trying to decipher the text but - you know - its technically supperior despite of its crappy UI”.

    I mean, Sun seems to have resources to do fancy stuff like Looking Glass and JDNC but this font rendering bug is open since 2002. Does Sun want to do research for MS or to deliver usable applications?

    And by the way, ant, jboss and tomcat aren’t Swing applications and NetBeans is becoming obsolete.

    How many non-devtools widespread Swing applications do you know?

    This isn’t about native look and feel. Even MS Office uses a custom widget set. This is about usability.

    Regards, Steve

  10. Clown Puncher Says:

    It’s the CRAPPY ASS OS you use!
    Switch to OSX dammit and shut the hell up.

    I code in NetBeans every day on an LCD with no problem. From my iMac on a 17″ LCD to my powerbook with a 14″ LCD (a four year old model no less!).

    Swing apps look fine on OS X.

    And NetBeans is far from “obsolete”. WTF are you talking about?

    Besides NetBeans, I use ThinkFree office. That’s Swing, isn’t it? Maestro is a Swing app. There are plenty.

  11. S. Gersmann Says:

    On MacOS I admit it’s different and the powerbook has a lower resolution (the MacOS Swing implementation is done by whom?). I stated above that I like NetBeans but a amateurish empiric poll led me to the observation that it is loosing significant market share. And lets try to stay polite.

  12. Davide Inglima - limaCAT Says:

    Steve you wrote:
    “But in the end it is possile to build usable applications with them.”

    On portable usability I already wrote this rant:
    http://limacat.blogspot.com/2004/06/bile-sorry-state-of-online-news.html
    and I don’t want to repeat myself here :)

    “it’s the small things that matter and make an application a good application.”

    Small things like you not having to get crazy to repackage your application for another platform? Or that you don’t have problems like Garbage Collection going haywire since you forgot to do a flush.button(”flush”); somewhere in your code?

    “And by the way, ant, jboss and tomcat aren’t Swing applications”

    They aren’t swt either, but they do have the least amount of code needed to make them run in very diverse environments: one .bat file for windows and one shellfile for the other unices.

    “and NetBeans is becoming obsolete.”

    ROTFLMAO!!!

    “How many non-devtools widespread Swing applications do you know?”

    How many non-devtools widespread client-side GUI Java applications do you know in general?

    “This isn’t about native look and feel. Even MS Office uses a custom widget set. This is about usability.”

    And one single minor problem (even if somehow important) cannot spell general doom for a platform.

  13. Davide Inglima - limaCAT Says:

    “loosing significant market share”

    Hell… even emacs is rapidly loosing market share considering that everyone is going either to learn vi or using gedit and nano as their favourite linux/unix editor.

    But seriously, how much market share can a opensource application distributed for 0$ have?

    I can already envision the day when Netbeans defeats Eclipse, and Scott Mc Nealy soiling his pants while saying “OMG! I am letting one billion people use Netbeans for 0$ and I am defeating IBM on free giveaways market! I am the happiest man in the world!”.

    And then, explain this to me… should I care of the market or should I use stuff that I prefer use?

  14. Clown Puncher Says:

    “And lets try to stay polite.”

    Err…I’m sorry. I thought this was the BileBlog. My mista— wait a minute! This IS the BileBlog. So why don’t you go punch your clown. That’s a polite way to say go fuck yourself.

    Better yet, why not write an open letter to Sun telling them how you could fix the SWING/LCD problem you are experiencing if they would just open source Java. I’m sure that’s energy well spent. And I’m sure it would yield results as good as the ones you get when you tell people on the BileBlog to “stay polite.” pffft.

  15. Davide Inglima - limaCAT Says:

    How many Eclipse zealots do you need to change a lightbulb? One million and five.

    One million to rant on the serverside forums how much the former lightbulb from sun while portable sucked and was slow and how much the round socket was ugly, one to design a lightbulb with a square socket for windows, one to design the triangular socket for linux, one to measure that the new lightbulb gave 0.1% light more for 0.1% energy less, one to make pr announcements, and in the end one to do the actual coding.

  16. S. Gersmann Says:

    Quoting Hani:

    On the downside, when you have a bad UI, very very few users will be able to pinpoint what is so bad about it. Instead, they’ll hate your application and feel an incoherent rage towards anyone insisting they use it. It’s not like web shit where there are a few million html monkeys and two ways of doing everything; with rich clients, there are thousands of ways of doing everything, and about 3 people who know the right way. Finding the sweet spot is a task far more daunting than farting out yet another silly web intranet app.

  17. Davide Inglima - limaCAT Says:

    Steve: your point being?

  18. Clown Puncher Says:

    Yeah…we all read the entry. That’s why we’re here commenting.

    What’s your point?

    Oh, I get it. You don’t formulate your own thoughts, you just parrot what others have said. I should have caught on by your earlier posts.

    “NetBeans is loosing market share”

    “People are moving away from Swing to SWT”

    Now where have I heard those before? Gee, did you attend one too many Eclipse/SWT BOF/session this week?

  19. S. Gersmann Says:

    “NetBeans - which I personally like - ”
    “I believe that Swing is incredible fast”

    You are quoting out of context - cheap.
    My point was why Sun is not addressing this problem, if they have resources for Looking Glass and stuff like that. Swing on MacOS has proper font rendering, doesn’t it? But I’m out here, this is leading nowhere.

  20. Clown Puncher Says:

    “You are… cheap”

    yes I am, thank you.

  21. Laurens Says:

    I’m surprised that no-one has mentioned Swing’s excessive memory usage yet. Mind you, I’ve worked extensively with Swing (see link, for instance) and I like it for the most part. But I’m definitely prepared to put up with SWT’s slightly inferior - but also much simpler - API to get truly native-looking and behaving UIs that do not consume excessive amounts of memory.

    I always feel slightly embarrassed when I show off a Swing application to people. I cringe when they open the task manager and see that java.exe is using 25Mb (at least, often it’s even more). When I show them my new SWT applications (or Azureus or Eclipse) they go: “This is Java???”

    Bottom line is that a native UI will always beat a Swing UI. Swing is still *good enough* for some applications, though.

  22. Saint Peter Says:

    < When I show them my new SWT applications (or Azureus or Eclipse) they go: "This is Java???" />

    Same goes with Swing using Jgoodies looks. Go take a look at http://www.jgoodies.com . About memory … what’s 25M mem ? who the fuck cares ? buy a fucking 256M ram stick with $30 and you can even play alot of funny games. And see some movies too. Hear him, ‘I cringe when …’ Get a grip on yourself or you’ll see yourself looking like my coleagues that say C is better than Java because the JVM is written in C. Huh.

  23. Laurens Says:

    St. Peter, if you got out more and talked to real users (not just programming nerds) you would know that users *do* care about these issues. Memory usage remains a major sticking point no matter how much cussing you throw at it. Not every office has top-of-the-line machines with >256Mb RAM. Hell, some even have to make do with Win98 or even 95 and 128Mb. (Yeah, I can see your response coming: “who the f**k is using Win98 these days?”)

    Check out the link, you’ll see that I am using JGoodies for this project. I learned my lesson after having worked with Swing for years. Simple and plain: Swing cannot compete with native UIs.

  24. Davide Inglima - limaCAT Says:

    Laurens: I am working on a p3 500 with 512 megabytes of ram, and I would like to get away from Eclipse even if it is “the office standard”: both 3.0 and 2.1.3 gave me a crappy life in just 2 days and I fear (it’s a fear, so it’s not a rational projection for the future) it won’t be better for the time coming.

    Eclipse cannot simply compete with Netbeans stability. Netbeans -> portable. Eclipse -> not. Period.

    Special bonus reverse trackback (yes Hani, that means that as an added bonus I’m spamming your blog :D): click on the link I gave as URL for looking out at Eclipse in action on Linux, one of the antics of this afternoon. But hey! Eclipse is opensource!!!

  25. S. Says:

    You developing Java applications on a P3 500?

    Brave man.

  26. Anonymous Says:

    Poor man

  27. Anonymous Says:

    It’s amusing to consistently read FUD generated by Swing apologists regarding SWT and Eclipse when it’s clear they’ve never used it to build a significant application. The Eclipse platform is all Java code. The only native C code used is the JNI layer of SWT to render the native widgets. Claiming that Eclipse is not portable is just ignorant. Having used Eclipse on Win2k, WinXP, Linux and developed Eclipse applications I know from experience that the app is 100% portable and looks and feels right on each platform. If it doesn’t feel right on the Mac, it’s a bug that should be reported to eclipse.org.

    Are Swing people really still suggesting that users just need to buy more RAM to support their app? The only people who seem to enjoy Swing are the Mac owners. Congratulations, the 5% of you out there have a correctly implemented Swing API which uses *native* code just like SWT. The rest of us are stuck with emulated garbage on Windows and Linux.

  28. Davide Inglima - limaCAT Says:

    24.9.52.44 wrote:
    > Claiming that Eclipse is not portable is just ignorant.

    + + + +

    Dear 24.9.52.44. Could you please tell the Haystack people to release the Linux version of their Eclipse-based browser (the drop of 24 may 04)? Otherwise it seems that their 1337 swt application is still stopped at those nice old days where you needed to recompile your shi^Wprograms for every linux (and unix) distro that existed in the universe to make it matter for the community at large.

    Their contact e-mail listed on the website is haymaster@theory.lcs.mit.edu

    Thankyou.

  29. Davide Inglima - limaCAT Says:

    S. & 131.159.0.2. Actually to tell you the truth it did not seem to me that the p3 500 was *too much slow* to program on. Using Eclipse it seemed better than I could have expected.

    I must admit two things however: I worked on worse conditions (cough - ultrasparc 300+ 256mhz with forte for java 2.something - cough, that’s really slow), and I also had to do other work-related stuff… at home I have a better computer, and both Eclipse and Netbeans there behave well. (But I still use Netbeans… yeah, I am an opinionanted troll, please killfile me :D)

  30. s, Says:

    I’m working on P4 2.4 with 512MB ram, and there are times I can watch paint dry whilst switching tasks (usually caused by leaving eclipse too long and the os swapping it out).

    I’m going to get flogged here, but I’m using Eclipse for struts development with Struts Studio and I think it’s great (I was a intellij follower prior, and still would be if I wasn’t doing struts stuff).

  31. s, Says:

    I’m working on P4 2.4 with 512MB ram, and there are times I can watch paint dry whilst switching tasks (usually caused by leaving eclipse too long and the os swapping it out).

    I’m going to get flogged here, but I’m using Eclipse for struts development with Struts Studio and I think it’s great (I was a intellij follower prior, and still would be if I wasn’t doing struts stuff).

  32. Anonymous Says:

    Davide Inglima:
    I’ve never heard of Haystack before so I went to their download page and they claim support for Linux, Windows, and Mac. However, you seem to be implying that that application has portability problems. Just because one Eclipse based app. isn’t portable doesn’t have anything to do with Eclipse itself. I have deployed an Eclipse based app. (and used the Eclipse IDE) on several versions of Windows and Linux without recompiling anything. Let the FUD continue…

  33. Davide Inglima - limaCAT Says:

    24.9.52.44:

    > However, you seem to be implying that that
    > application has portability problems.

    It has problems with “WORA portability”. “C portability” in the Java world has no sense to exist and give problems to everyone else. An API that defeats the purpose of having Garbage Collection ha no sense either.

    Now I will get back to my inferior Swing programs, thankyou.

  34. Anonymous Says:

    Don’t you call jDialog.dispose() in your superior Swing programs? Well maybe you should. Doesn’t this offend your beloved GC left alone with worthless String objects?

  35. Davide Inglima - limaCAT Says:

    129.187.254.13: Actually there are already waaaaaay many fuckups in Java itself (and many more added every day, static imports for everyone!!!!) that adding SWT in the picture is blatantly suicidal, and 100% worth of a bilepost *g*. That is IMO

  36. Anonymous Says:

    If you had ever written an SWT program you would realize that you almost never have to call widget.dispose() manually. When a parent Composite is disposed, every child widget is disposed with it.

    UI programs don’t need the same WORA portability that other Java apps do. They just need to run on the major desktop platforms Windows, Linux, and Mac. But for the precious few of you out there SWT does support AIX, Solaris, HP-UX, etc.

    I’m not sure why Swing people are so upset by SWT. It’s an OSS project that you can use if you like or ignore if you prefer Swing. Are you also offended by the numerous other OSS Java projects that are different than the Sun offerings?

  37. Clown Puncher Says:

    ” If it doesn’t feel right on the Mac, it’s a bug that should be reported to eclipse.org. ”

    Why would Mac users even bother? I mean, the only reason they would even worry about SWT is if they were tricked into using Eclipse. Otherwise, all Swing/AWT apps look and feel just like a native app.

  38. Anonymous Says:

    Just look at the title of the talk, “Native looking swing UIs”. What a bunch of fuck heads, struggling to with a fake widget toolkit! Consider all that effort. What a waste when you can just use the real thing.

Leave a Reply