Better looking Java Apps
One of the annoying things about GUI applications written in Java is that they do not conform at all the the Operating System's look and feel. As a result Java applications not only feel slow, but also look like an application that you should run on Windows 95. I fault Sun for not doing a better job with Java's default look and feel on Windows (The look and feel on Mac OSX is very nice, which is one reason I suppose many Java Developers prefer Mac's). I've heard that Java 1.5 will have an updated look and feel, I'm looking forward to that.
I noticed today that there is a class called SystemColor in the java.awt package (so it has been around since Java 1, yet no one uses it). The class has static fields that define things like the System window color, control color, select color, tool tip color, desktop color, shadows, etc. So for example if you have some Component all you need to do to make it show up with the proper color is the following:
component.setBackground( SystemColor.control );
I tested this on Windows XP, and it shows up in XP's tanish window color, which looks much better than the dark silver color that Java defaults to!http://java.sun.com/j2se/1.4.2/docs/api/java/awt/SystemColor.html
Like this? Follow me ↯Tweet Follow @pfreitag
Better looking Java Apps was first published on November 13, 2003.
Want Security Advisories via Email?
Advisory Week is a new weekly email containing security advisories published by major software vendors (Adobe, Apple, Microsoft, etc).
Eclipse doesn't use Swing, it uses SWT (the Standard Widget Toolkit) http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html
SWT makes JNI calls to native OS widgets, which is why eclipse is so much faster, and feels more like a native OS Application.
However, Java Swing can be implemented such that it uses the native OS widgets. This is how Java Swing works on Mac OS X for example.
Of course, one should also take a look at Project Looking Glass from sun, which is one of the most beautiful windowing systems around and is quite snappy.