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

JavaSwingUser InterfaceLook and-FeelSwingx

Java Problem Overview


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?

Java Solutions


Solution 1 - Java

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 2 - Java

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 3 - Java

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 4 - Java

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 - Java

Try one of these:

  1. JTattoo
  2. JGoodies
  3. Quaqua

Solution 6 - Java

I've had good experiences with FlatLaf.

It's easy to install, it's cross-platform, it has no external dependency, it's open-source (Apache license), it includes dark modes and there are tons of themes.

light

dark

After adding :

UIManager.setLookAndFeel( new FlatLightLaf() );

your app looks like it was written during the last decade, and not during the previous millenium.

It also has one high-contrast theme, for accessibility.

Solution 7 - Java

What about Nimbus look and feel? Oracle Link Also take a look at SO-Question

Solution 8 - Java

I know this question is old, but if you don't want to use FX and still want to use Swing, then try MacWidgets, i've used it on a couple projects. It's very light, and looks great. Below is an old project i was working on, over time i've perfected using macwidgets and now use it internally in my company.

http://www.digitalhand.net/projects/jdataanalyzer/mainGUI.png

Solution 9 - Java

QT is quite extensive but also very big (bloated) and complex. There is also the SWT library being used by open office for instance. SWT uses native UI widgets for buttons, tables etc where as Swing emulates them.

However, the trend is clearly towards writing rich client applications for the browser using HTML and Javascript. Both of these have made huge strides in the past few years.

HTML5 specifically targets rich client applications with features such as better forms and local database to support disconnected scenarios (note that this last feature is not standardized yet but it is implemented by all latest browsers).

Javascript has now powerful libraries with jQuery and its many plugins. There are even languages like Coffeescript which can be used to produce Javascript with a simpler and more powerful syntax.

There's also no need for such apps to connect to an outside server. Small footprint local servers (eg: jetty, node.js, ...) and databases (SQLite, H2,...) can be installed on the client to make a completely self contained application.

Solution 10 - Java

Swing is good (stable, documented, supported until 2026). The problem is that it relies on the LookAndFeel system that provide a very limited number of boilerplate choices. It should be easy to change the appearance of each component individually and then unleash its creativity. Unfortunately it is painful. IMHO frameworks should be built on top of Swing to make it possible instead of creating JavaFX.

Take a look at https://github.com/dotxyteam/ReflectionUI.

Ex GUI: http://javacollection.net/reflectionui/wp-content/uploads/2017/08/general.png

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsanityView Question on Stackoverflow
Solution 1 - JavaMikle GarinView Answer on Stackoverflow
Solution 2 - JavaBringer128View Answer on Stackoverflow
Solution 3 - JavalrAndroidView Answer on Stackoverflow
Solution 4 - JavaBruno GriederView Answer on Stackoverflow
Solution 5 - JavaCrazenezzView Answer on Stackoverflow
Solution 6 - JavaEric DuminilView Answer on Stackoverflow
Solution 7 - JavakeuleJView Answer on Stackoverflow
Solution 8 - JavaJesse HernandezView Answer on Stackoverflow
Solution 9 - JavaBernardView Answer on Stackoverflow
Solution 10 - Javauser3649688View Answer on Stackoverflow