How can I create a "modern looking" Java desktop application?

67,117

Solution 1

Look into changing the Look and Feel of your Java program. This allows you to customize the overall "theme" of your program. Here is information on changing the LAF.

Solution 2

I can also offer you a new LaF to look into - WebLaF. I'am currently working on it to bring a lot of UI features and make work with Swing much easier for anyone by just using WebLaF library basic features.

A few examples showing how some of WebLaF components look like: Some of WebLaF components

Some of main goals i am targeting:

  1. Great and modern-looking L&F with support for all Swing components
  2. An extensive set of additional components which you won't find in standard Swing
  3. A big set of Utility classes to assist you with writing the code

WebLaF library also suggests a few other advantages and unique features:

  1. It is an open-source project (GPLv3 licensed)
  2. Easy components styling using painters system (specifically with 9-patch files)
  3. Quick and easy customization of the default "Web" style
  4. Lots of features to accelerate and simplify Swing application interface creation

You can try the demo-app to see if it is modern and simple enough :)

Solution 3

Have you looked into JavaFX 2.0? It is designed to interop easily with Swing, and has many modern 'good looking' controls.

Also, as lrAndroid mentions, a Swing app can look like a native app if you set the system look and feel with:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Solution 4

Modern Javascript frameworks (ExtJS, Dojo, etc...) offer the same widgets richness or more (Excel like grids for instance), a wider variety of L&F and usually fit better with the OS of the user. Users are also very comfortable with their browsers and, hey, "modern stuff" is on the web, and the modern web today is HTML+Javascript.

The overhead of converting an app to "web like" is minimal. An embedded Jetty can remain really small and disk space has become much less of an issue.

There are additional benefits going down this route for the future evolutions of the application.

  • Suddenly, the desktop app becomes a server app, which can be accessed from another desktop. We were able top promote a desktop app to 'portal' in a matter of weeks.
  • Rewriting the app in terms of (Ajax) web services provides an easy transition to creating a full REST (or SOAP...) services stack. The app can then be integrated to other applications, easily monitored externally, etc...
  • Support of other devices (smart phones, tablets,...) becomes much easier, by concentrating on the UI layer only
  • As the app grows, separation of concerns is cleaner; developers working on the UI do not have to mess with low level code.
  • There are a lot of excellent JS/HTML designers and developers that do not program in Java.

EDIT

3 years later this has become extremely easy thanks to Electron

Solution 5

Try one of these:

  1. JTattoo
  2. JGoodies
  3. Quaqua
Share:
67,117
sanity
Author by

sanity

I'm an entrepreneur and computer scientist, with a particular interest in Artificial Intelligence and Peer-to-Peer. My two most notable projects are Freenet and Revver (I'm founder and co-founder respectively). My current projects are a predictive analytics system called SenseArray, and a new approach to distributed computation called Swarm. You can find my personal blog here. While I've used C, C++, ML, Haskell, Prolog, Python, even Perl in the past, these days I do most of my programming in Java. I am gaining experience with Scala though and expect to become my primary language as it and its tools mature. I was honored to be asked by Scala's creator to be on the program committee for the first Scala workshop.

Updated on August 02, 2022

Comments

  • sanity
    sanity almost 2 years

    Similar questions to this are asked periodically, but many of these answers are outdated.

    I need to build a cross-platform desktop application in Java with a GUI of comparable quality to contemporary desktop apps.

    Swing is the default choice, but I have yet to encounter a Swing application that didn't look, at the very least, quite dated and clunky (subjective, I know, but with GUIs it's hard to avoid aesthetic judgements).

    I notice that the new Bitcoin client now uses QT with Java bindings, and does have an attractive user interface, but this has the disadvantage that it is no-longer pure Java.

    So much of what I find when I search for Swing-related libraries is 5 years old or older, even though the aesthetics of desktop applications have evolved significantly since then.

    If you needed to build a Java desktop application from scratch, what would you use for its GUI?

  • sanity
    sanity about 12 years
    Yes, I'm aware of that - do you have any specific recommendations about good modern LAFs for Swing?
  • lrAndroid
    lrAndroid about 12 years
    I personally prefer the GTK LAF. Here are a couple other nice looking ones: dlemmermann.wordpress.com/2011/05/10/….
  • sanity
    sanity about 12 years
    Can you provide any examples of modern desktop apps that have web-based UIs? I know Freenet does it, but it's hardly an example of good UI design :-/
  • sanity
    sanity about 12 years
    How do you handle launching the web browser in a cross platform way? Can you cite some examples of modern desktop apps using the web browser for their UI?
  • Bruno Grieder
    Bruno Grieder about 12 years
    With Java 6+ Desktop.getDesktop( ).browse( new URI( uriString ) );
  • Bruno Grieder
    Bruno Grieder about 12 years
    ..which you may associate with a TrayIcon. If your app is running in the background, the UI can be 'shown' by clicking on the icon and performing the call above again.
  • Bruno Grieder
    Bruno Grieder about 12 years
    Modern applications: using the browser for local apps is what is behing Adobe Air and HTML 5 storage (Google ditched its application when HTML5 came along with similar functionalities).
  • Karim Massi
    Karim Massi over 10 years
    your the best this LAF is great :)
  • jewelsea
    jewelsea over 10 years
    Absolutely beautiful piece of work Mikle, you are to be commended.
  • mKorbel
    mKorbel over 10 years
    +++ top of L&Fs, please to ignore - but have to do something with getPreferredSize (one constant for whole L&F applyied for all JComponents) and gap v.s. alingment for Standard LayoutManagers (sure who cares about)
  • Mikle Garin
    Mikle Garin about 10 years
    @mKorbel didn't really understand what you mean. Preferred size with WebLaF acts the same way as it does without it, WebLaF just provides a few addittional options to configure it. And i didn't do anything about standard layout managers - WebLaF uses almost the same layout style MetalLookAndFeel does with just a few small improvements, as i recall, and doesn't change any layout-related stuff. Though i might be missing something - would really love to know if there are actually any bugs presented :)
  • mKorbel
    mKorbel about 10 years
    interesting info, you are overrode MetalLookAndFeel, maybe to corresponded to my comment about non_proportional painting on the screen, my question is do call doLayout (few small improvements, as i recall, and doesn't change any layout-related stuff), I'll post a comment with printcreen when I'm play with your L&F in next time
  • Teddy
    Teddy about 10 years
    Amazing! And high quality demo too!
  • Don Cheadle
    Don Cheadle about 9 years
    interesting ideas... By chance do you know of some products which took this approach to desk top apps?
  • MWiesner
    MWiesner over 2 years
    Thanks for the hint. FlatLaf looks very convincing.
  • Eric Duminil
    Eric Duminil over 2 years
    @MWiesner: You're welcome. It was a pleasant surprise, since Java GUIs tend to come with 90s look otherwise. It's still in development, and 2.0 looks promising.