pf » Better looking Java Apps
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.htmlOf 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.
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.
- Top 10 Reserved SQL Keywords
- Web Design Tips for Programmers
- Geolocation API for Adobe AIR?
- Dear SQL Server Enterprise Manager Developer
- PostalMethods - Web Service for Snail Mail
- Mastering CFQUERYPARAM
- Google Code Search for ColdFusion
- Speaking at CFUNITED 2008
RSS
add to del.icio.us
Pete Freitag is a software engineer, and web developer located in










