James Williams
LinkedInMastodonGithub

Look like the natives

Tags: Java

When I talk to friends about developing an idea for an app in Java, I always get comments that I should do it in Adobe AIR because Java is ugly. It isn't, per se. It just takes effort to make it look pretty:

  1. *Unless you can guarantee your install base is using Java6 or higher, don't use the default LookAndFeel.*

    Before Java 6, the default LookAndFeel was Metal, the really ugly mess that gave Java a bad name in the first place. That has been rectified in Java 6 and above with Nimbus. Many devs seem to go with the default instead of exploring what their users might appreciate. Javatoo and JavaDesktop are good sources for news and links to different LookAndFeels. My personal favorites are Nimbus and Substance.

  2. Have options.

    One thing that the Groovy Swing team has done is to give the LookAndFeel selection code a couple of choices it can degrade to if the preferred choice is not available.

    It may take a little extra effort but if you have a sizable amount of Mac users and aren't using any special LaF, it might be a good idea to explore Quaqua. It will give your users a native looking Java app and you'll benefit from the level of familiarity that they get from other Mac applications. Your app won't stand out as the "ugly Java thing" they have to use because there isn't a Mac version.

  3. Go naked.

    Naked meaning undecorated. Because Java is a layer over the operating system, when you execute a call to draw a JFrame or JXFrame, you are asking the operating system to retrieve and a native window canvas to draw your application. If you are one of the few that actually architects a beatiful user experience, you are quickly betrayed by the title bar of the window which probably clashes with your LookAndFeel(unless you use one that duplicates your OS). If your core design is innovative enough, you can complement your design by making the frame undecorated, thereby hiding native details, and providing your own navigation/resize/close panel. There is a bit more work involved in this tactic because you will have to also consider if you want the same level of detail and integration with any dialogs or popup windows. One application that uses this method is Aerith, a smashup of Google Maps, Flickr, and Yahoo's geocoding service.