5

I am planning to develop a desktop application that allows to manage client data. I am an experienced Java programmer but I have never really been able to do attractive interfaces in Java, for instance, I personally think the default Swing components are horrible (when I compare it for example with a recent web interface).

So first question would be, how can I make sexy interfaces in Java (that still run on all platforms) ? Secondly, wouldn't it be a good idea to make the interface in HTML5? Isn't it possible to run an HTML5 interface without a web server, as I don't need the application to be accessible online, thus I don't need a server.

Matthew
  • 10,988
  • 11
  • 54
  • 69
  • 4
    See the book [Filthy Rich Clients](http://filthyrichclients.org/). – Jesper Oct 04 '12 at 12:55
  • 1
    You might want to search for Java's new Avatar project, too – hage Oct 04 '12 at 12:58
  • I'm not sure how you'd couple an HTML5 interface to application logic without a server. It can probably be done, i just have no idea how. Note that a web server is not a difficult thing to add to an application; there is one [built into the JRE](http://docs.oracle.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/package-summary.html). – Tom Anderson Oct 04 '12 at 13:09
  • See this similar questions answer: http://stackoverflow.com/a/12322344/1133011 – David Kroukamp Oct 04 '12 at 13:16

5 Answers5

4

The default Metal Look and Feel is not too attractive, I agree, but there are other Look and Feels for Java. Nimbus is included in the JRE since Java SE 6 Update 10, which is newer than Metal and looks cooler, you might wanna check that out:

http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html

Also there are many external Look and Feels which you can download and bundle with your application. Some examples:

http://geeknizer.com/best-java-swing-look-and-feel-themes-professional-casual-top-10/

http://www.java2s.com/Product/Java/Swing/Look-And-Feel-LaF.htm

icza
  • 389,944
  • 63
  • 907
  • 827
3
  • Metal Look and feel is not friendly (at all), and let's not even consider Motif.

  • Nimbus does a much better job, but still does not look right nor feel natural

  • However, on each platform, you can use the "System" look and feel: looks ok, feels natural-->Good user experience.

  • If you want to create you own look and feel, take a look at Synth. It is a little bit like you could apply CSS to your Swing components.

To use the System look and feel, nothing easier than calling this (before starting any UI related things):

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
    e.printStackTrace();
} catch (InstantiationException e) {
    e.printStackTrace();
} catch (IllegalAccessException e) {
    e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
    e.printStackTrace();
}
Guillaume Polet
  • 47,259
  • 4
  • 83
  • 117
  • Motif ... I have users who are actually using that and even worse, like it. Specially the extra clicks you have to do to access a submenu. – Robin Oct 04 '12 at 19:20
2

There are quite a lot of really nice APIs for that. One of the best was Substance, which is officially discontinued but there is an active fork called Insubstantional.

It's pretty easy and you can customize it heavily, see more screenshots here like this:

enter image description here

You may find the JGoodies and the SwingX projects also interesting.

You can also take a look on JavaFX, it is possible to include JavaFX components in Swing applications (you can find interesting articles about that in the Java Magazine) and vice versa. You would like it because you can use CSS for example to customize the outlook.

rlegendi
  • 10,466
  • 3
  • 38
  • 50
2

If you want to write a traditional desktop app, you might like to look at SWT, an alternative widget tookit. It's the widget set used for the Eclipse IDE; i think that looks pretty good, certainly much better than most Swing apps (cough cough IntelliJ).

Tom Anderson
  • 46,189
  • 17
  • 92
  • 133
1

I personally think the default Swing components are horrible (when I compare it for example with a recent web interface).

  • yes (since 2001/2 stable GUI, with long buggy history, there is quite everything possible)

  • not, most of web interface looks like as Circus

So first question would be, how can I make sexy interfaces in Java (that still run on all platforms) ?

use Custom Look and Feel for Swing GUI

Secondly, wouldn't it be a good idea to make the interface in HTML5? Isn't it possible to run an HTML5 interface without a web server, as I don't need the application to be accessible online, thus I don't need a server.

this possible official Oracle API for JavaFX2.x, or ???

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319