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).