Now blogging at diego's weblog. See you over there!

Why the 'Java Stigma' - Part 2

Glen was asking for some sample code for BoxLayout/BorderFactory, and
here it is. It's a simple frame with a set of components inside,
mostly a copy of the code I use in spaces to create the "Edit Mail Account"

In the previous entry on this topic I mentioned Borders and Layouts as one factor that affect how a UI looks in Java. Another factor is... the details (where the devil is :-)). Things that we tend to take for granted but that are really what makes an application feel "solid" or simply well done. These are things that in general I think contribute to the stigma of Java being unable to support client applications properly.

Take colors.

For example, suppose that you have a JTable in a JScrollPane. Because the table is by default not opaque (the cells are) if you have a larger ScrollPane than the rows in the table you end up with the unpleasant side effect of seeing one background color (for the table) and another for the ScrollPane. Except that the ScrollPane isn't handling the background, it's the JViewport inside the JScrollPane. So when using tables in scrollpanes the following line always comes in handy:

Another example of details that make an application feel strange are icons. In the case of spaces, I created the icons myself (except for a few that I used from the Java Look and Feel Graphics Repository) after I noticed that the icons were making the app feel like ... er, wrong. Finally, details are not only visual, they are also behavioral. Consider right-click menus. Right or wrong, people have gotten used to right-clicking everywhere on an interface. In some cases, if the right-click popup menu isn't there, the application feels incomplete.

In sum, it's not that Java doesn't do it, but simply that what in other platforms is already taken care of (and you have to give Microsoft credit for making it easy to build "proper" Windows-looking with Visual Studio) has to be done more or less "manually" in Java, and sometimes it's not obvious how to do it.

Next topic (tomorrow? Friday?): UIs as an afterthought.

Categories: technology
Posted by diego on December 4 2002 at 5:45 PM

Copyright © Diego Doval 2002-2011.
Powered by
Movable Type 4.37