Developer on the JavaFX & Swing teams at Sun Microsystems. Working on the new JavaFX UI Controls and Graphics frameworks. Also building demos and presenting at conferences on JavaFX and Swing. Prior to Sun was working for my own company Xerto on Imagery a Java photo management application. Jasper has posted 1 posts at DZone. View Full User Profile

Which Look and Feel Should be Default in Java 7?

03.17.2009
| 11183 views |
  • submit to reddit

The other day I was discussing with colleagues if Nimbus should be the default LAF(Look and Feel) for Swing applications. The current default LAF is Ocean which is a spiced up theme for Metal which has been the Swing default LAF since the beginning.

It feels like with a large release like Java 7 it is about time we changed the default LAF to a more sensible choice which leaves two choices Nimbus which is the new cross platform LAF and the system native LAF which will be Windows LAF on Windows and GTK LAF on Unix. A

pple has already gone with the system native choice and the default LAF for Java Swing applications on Mac is Apple’s Aqua native LAF. The only reason for remaining with Ocean LAF is to maintain backwards compatibility for old Java applications which were written with static pixel based layout so will be all messed up if the size of components changes.

My feeling is that sector of users should be getting pretty small now and as long as we provide a easy work around like system property file that lets a user/administrator change the default LAF back to Ocean for those few special cases then we can move forward and select a modern LAF as the default. So then it comes down to what to choose Nimbus or Native(Windows/GTK) I am torn between the two. So we decided the best idea is to ask more people, so what do you think? Come and vote at our Poll

References
Published at DZone with permission of its author, Jasper Potts. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Ryan Developer replied on Tue, 2009/03/17 - 7:40am

I think Java Swing applications should look native on the OS they are running on by default.  Only when you need the application to look exactly the same on all OS's should you choose a LAF like Nimbus.  People have criticized Java in the past for not looking native, and I agree with them. 

Robert Greathouse replied on Tue, 2009/03/17 - 8:01am

What does "native" look like anymore? Does Internet Explorer 7 and 8 look native? What about Office 2007 and Google Chrome?

Andrew McVeigh replied on Tue, 2009/03/17 - 8:28am in response to:

trouble is that the native LnF, particularly on Linux/GTK is pretty awful.  Only works correctly without generating lots of resource warnings on the default theme.  Plus, menus do not have any borders.

Even nimbus gives problems on Linux.  I find that drop-down jcombos regularly crash this LnF under Ubuntu (I don't know about others).

How about JTattoo (www.jtattoo.net) for a default ;-)  That looks great and I've never seen it go wrong under any OS.

 Andrew

Mark Haniford replied on Tue, 2009/03/17 - 9:49am

trouble is that the native LnF, particularly on Linux/GTK is pretty awful.  Only works correctly without generating lots of resource warnings on the default theme.  Plus, menus do not have any borders.

 

It's not really trouble because Windows is the dominant desktop, and they finally got Swing looking good on it.  Native L&F should obviously be the default, but I expect Sun to once again make the wrong decision.

 

 

Developer Dude replied on Tue, 2009/03/17 - 10:50am

The default look and feel should be the system/native look and feel. Unless there is a very good reason Java desktop apps should be indistinguishable from native apps. Not using a native look and feel has done as much harm as anything else with regards to poor acceptance of Java desktop applications. If there are problems with the native L&F on any platform then the problems should be fixed.

Andrew McVeigh replied on Tue, 2009/03/17 - 10:53am in response to: Robert Greathouse

What does "native" look like anymore?

It's a good question. I bought a super-whizzbang alarm clock the other day that can download sleep patterns via USB into a slick GUI. Anyway, to cut a long story short, I was thinking to myself "they've made the GUI look really nice, sort of a bit like some of the Sony stuff I've used before".

And then I realised that it was simply the WhiteVision Synthetica look and feel running via a Java Swing GUI. I know this LnF well as I've previously purchased and used it. However, i guess I wasn't thinking about being a programmer just at that point, and as a consumer just thought that it looked like some slick windows app... It made me wonder if we apply different criteria to Java GUI apps, simply because we lose perspective on what the end user thinks.

Pictures of the actual GUI are in this pdf: http://www.axbo.com.ua/files/aXbo_research_ukr.pdf

Here's a webstart of it: http://www.axbo.com/webstart/aXbo.jnlp

(It doesn't do a lot though if you don't have one of the clocks ;-)

The app worked like a dream. Ironically however, it was limited to Mac and Windows (probably because of device drivers) :-(

Andrew McVeigh replied on Tue, 2009/03/17 - 10:55am in response to: Mark Haniford

It's not really trouble because Windows is the dominant desktop

Well, it's trouble for non-Windows users, and violates the spirit of WORA.  If they make the native LnF the default, they have some Linux work to do. 

Andrew McVeigh replied on Tue, 2009/03/17 - 11:00am in response to: Andrew McVeigh

Ironically however, it was limited to Mac and Windows (probably because of device drivers)

Whoops, I spoke too soon.  I plugged the clock into my linux machine, started up the webstart app, and it all works flawlessly under Ubuntu.  Cross platform lives on!

Andrew 

Sergey Surikov replied on Tue, 2009/03/17 - 11:45am

There are no "native" GUI. All realy pretty applications has own LAF

  • Adobe Acrobat Reader
  • MS Office
  • MS Visual Studio
  • Google Picassa
  • etc

Mark Haniford replied on Tue, 2009/03/17 - 11:47am in response to: Andrew McVeigh

Well, it's trouble for non-Windows users, and violates the spirit of WORA. If they make the native LnF the default, they have some Linux work to do.
Actually, it's only trouble for X11 users. On Mac, it looks fine. The Linux desktop market is way too small to say that just because native doesn't look good on Linux that it shouldn't be native by default.

Andrew McVeigh replied on Tue, 2009/03/17 - 12:06pm in response to: Mark Haniford

Actually, it's only trouble for X11 users. On Mac, it looks fine.

Well, Java 1.5 looks fine with Quaqua under the Mac.  as for 1.6 and SoyLatte, I think we can all agree it doesn't look fine. 

Mike P(Okidoky) replied on Tue, 2009/03/17 - 12:14pm

Take no risks! Leave it what it is by default. Java right now is one of the, if not the, most portable WORA platform there is. Don't mess with that ! ! !

However, isn't there a prefernce setting you can define in the jcontrol panel? I briefly googled around to see what setting that is, but couln't immediately find it. Anyone know?

Andrew McVeigh replied on Tue, 2009/03/17 - 12:21pm in response to: Mike P(Okidoky)

The setting for swing.properties is:

  swing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel

so you can probably add this to the java runtime flags in jcontrol via -D. 

 

Ivan Lazarte replied on Tue, 2009/03/17 - 1:00pm

I agree that the native fad is kind of over. I would actually argue nimbus is the way to go until Sun comes out with another cross platform LAF that is more business-like.

JeffS replied on Tue, 2009/03/17 - 4:22pm

Nimbus has my vote.  It looks very slick and modern and comfortable.  To me, Nimbus is a big improvement over Ocean.  And I agree that their should be a configuration in the Java control panel that allows the user to tell apps to be Ocean by default, if need be (in those rare cases where Nimbus doesn't work right with a legacy app).

I think native LAF is way overrated.  Most of the biggest commercial destkop apps typically don't maintain complete native LAF.  Even with Windows, Microsoft's own desktop apps don't maintain complete native LAF, and native LAF has a lot different connotations.  So long as it looks good, and behaves well (particularly meeting end users behaviorial expectations), it's fine.

I think only developers obsess over native LAF.  Most end users couldn't care less.  Again, so many popular desktop apps have many different LAFs.  It can actually be a competitive advantage for ISVs to make their desktop apps have their own unique, cool LAF.  Most people do not expect applications to blend 100% with the native environment.

 Personally, I alwasy configure a Swing app to have Nimbus LAF, if it's possible with the app in question.  I've done so with Netbeans, jEdit, and Makagiga.  Also, any Swing apps I write, I prefer Nimbus.

Developer Dude replied on Tue, 2009/03/17 - 4:57pm

JeffS, It is the users who have complained the most about Java desktop apps (biz apps anyway) not being faithful to the platform. I have written a lot of Java apps that targeted both Windows and OSX (and OS9) and the Mac users always complained when the app wasn't faithful to their beloved OS. Windows users complained when the app wouldn't reflect their theme changes and desktop customizations, or when an app had a W2K L&F on an XP platform.

If it was up to devs they would pick some whiz bang L&F they prefer (personally, I would emulate Aqua on every platform if I was the only user).

A lot of Swing apps are intranet or vertical market business apps where the user doesn't really care what you developed the app in, just that it does what is needed and looks and feels like the rest of their apps. One of the biggest complaints I have heard about Safari and iTunes on Windows was that they used the OSX L&F.

As for big companies getting away with non-standard L&Fs: I don't work for those companies and my apps need to conform to user expectations, not drag users along kicking and screaming because I can (I can't - I'm not Microsoft, or Adobe, or Apple).

Standardization on a platform is important whether you are MS or Adobe or some small dev company - users need to get work done, not learn some new paradigm (I hate the new MS Office L&F, it adds nothing to my productivity - indeed, I am always hunting around for something that I used to know right where to find it).

Sergey Surikov replied on Wed, 2009/03/18 - 12:14am in response to: Developer Dude

MS ribbon control is control not L&F

Developer Dude replied on Wed, 2009/03/18 - 11:55am in response to: Sergey Surikov

A single UI component not using native L&F does not make the whole app non-native L&F. Several of the Swing apps I wrote were for the pre-press layout industry - people who were accustomed to Adobe and Corel apps. Some of the UI components were property sheets/editors and tried to be similar to Adobe Illustrator/Photoshop/etc. in their behavior and L&F because that is what the users were used to working with, but even if those varied somewhat from the platform, the rest of the app tried to stay true to the platform when it came to more generic UI components (windows, dialogs, etc.).

All I am saying is the default should be native not that the L&F must be native. Standard app devs (those who write biz apps, which are the majority of Java Swing apps, although they may each only have a few dozen to a few thousand users) should try to be as faithful to the native L&F for a platform as possible as that is generally what their users expect. Look & Feel and behavior should be familiar to the user, not a jarringly different experience every-time they use an app just because the dev or the PM preferred some non-standard L&F over the native L&F. If some component is different, then there should be a very good justification for that difference, not just a matter of taste.

There are other classes of apps where a non-standard L&F is okay (multi-media apps, etc.), but not most apps. It it is up to the dev - changing the L&F is not that hard if you chose it from the beginning.

Wong Qil replied on Thu, 2009/03/19 - 9:15pm

The best laf is close to native but Beyond native.

Milind Rao replied on Fri, 2009/03/20 - 2:18am

I would vote for Nimbus if two things are fixed.
  • Nimbus crashes because many Metal properties don't exist. It needs to add *all* metal properties and redirect them to the corresponding Nimbus properties. I don't recall off hand all the problems I had when I switched our app from JGoodies Plastic to Nimbus. But we weren't doing anything special so this should happen on most apps.
  • The awful dull default colors of Nimbus are changed. At least provide a few themes.

    Also, I have been waiting for the tools to change Nimbus properties and icons. But this focus on JavaFX and the loss of senior Java Developers in the Swing group has really damaged Swing progress over the last 2 years. I had great hopes for client Java after the 2005 and 2006 JavaOnes. The new plugin is excellent. But Swing itself has seen no progress at all in the last two years. A few projects started and just dropped. Very disappointing.

  • Karsten Silz replied on Sat, 2009/03/21 - 4:06pm in response to: Developer Dude

    I fully agree.  "Looking funny" (i.e., non-native) has hurt Java desktop apps from the very beginning, and it was only Eclipse using native components that pushed Sun to come closer to nativeness.  It's still not there (and may not get there) - just look at the "File open" dialog on Windows: Where are all my native context menus?  Eclipse has them since it uses the native dialog, but Swing only emulates it.

    James Walker replied on Sat, 2012/10/06 - 3:06am

    There are other classes of apps where a non-standard L&F is okay (multi-media apps, etc.), but not most apps. It it is up to the dev - changing the L&F is not that hard if you chose it from the beginning click here

    James Walker replied on Tue, 2012/11/27 - 12:12pm

    Be grateful you for a additional elemental affect up. Everywhere moreover may maybe anyone get with the intention of rank of in rank in such a exact way of prose? I be inflicted with a presentation incoming week, and I am on the vantage top for such in rank home page

    Zem Karlos replied on Mon, 2013/03/11 - 9:54pm in response to:

     keep on posting such articles resources like the one you mentioned here will be very useful to me! Excellent post. I merely came across your site and wished to say that I have really loved reading through your blog posts. Any ways I’ll be subscribing for your feed and I hope you post again soon.

    Zem Karlos replied on Mon, 2013/03/11 - 9:56pm

     I was able to find the details that I was searching for. I must thank you for the initiatives you have made in writing this article. I am expecting the similar best efforts from you in the future as well.

    Zem Karlos replied on Wed, 2013/05/01 - 10:00pm

    Roof repair Specialist Simply wish to say your article is as astonishing. The clarity in your post is simply cool and i could assume you’re an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million and please continue the enjoyable work.

    Zem Karlos replied on Sun, 2013/09/01 - 4:20am

    Orlando Roof repair  This is a good post, I was wondering if I could use this write-up on my website, I will link it back to your website though. If this is a problem please let me know and I will take it down right away. 

    Comment viewing options

    Select your preferred way to display the comments and click "Save settings" to activate your changes.