aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes window decorations - native or Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "window decorations - native or Swing" Watch "window decorations - native or Swing" New topic
Author

window decorations - native or Swing

Jay Bromley
Ranch Hand

Joined: Aug 09, 2003
Posts: 48
Hello all,

I was wondering what all of your takes on window decorations (min/max buttons, title bars, etc.) is. That is, should the app use Swing window decorations or native window decorations? I personally think window decorations are a window manager's job, as it guarantees uniformity of appearance, however, I'm wondering if Sun wants to see Swing decorations.

I noticed that Max's app uses native (wm-supplied) decorations and so this got me wondering.

Thanks and regards,
Jay
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
In my opinion you should make every attempt to match the application to the native look and feel of the system. Not only does this add to the professionalism of your application, but it also improves functionality. Several Human-Computer Interaction studies have shown that users are more efficient when using an application that uses the same conventions as the operating system it is operating on. (FYI, this is the same basis for my argument to include the "standard" File menus in every application.)



“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Jay Bromley
Ranch Hand

Joined: Aug 09, 2003
Posts: 48
I agree with you, as mentioned above, I think all GUIs presented by a window manager should be the same. This, however, presents a problem for me. To have my Java app present a consistent look and feel I have to use the com.sun.java.swing.plaf.gtk.GTKLookAndFeel class. On my system, UIManager.getSystemLookAndFeelClassName() returns javax.swing.plaf.Metal, which is not what most apps on my system look like, hence the need for the above mentioned class. Is this class part of the normal JDK? I haven't downloaded it specifically, so I have to assume it is.

Am I thinking too much about this for the SCJD? In the real world what happens when you want the app to look native on all platforms? Apparently some platforms (mine - Linux, no Gnome or KDE) can't tell Java what their native look is, so simple querying may not work.

Thanks and regards,
Jay
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
From Sun:

The GTK+ look and feel was released in all versions of the 1.4.2 SDK. However, it was not included in the 1.4.2 JRE release for Microsoft Windows. If you are running the 1.4.2 JRE for Windows and wish to use the GTK+ look and feel, you need to download the 1.4.2 SDK. We expect GTK+ to be shipped for all platforms in future JRE releases.

I would be a little worried about hard coding the GTK look and feel, because I have no idea if the examiners test the application using the JRE or the SDK.

If you use the UIManager to return the system look and feel with the code I put in my earlier post, it will return the Windows look and feel on Microsoft Windows platforms, the Mac OS look and feel on Mac OS platforms, and the default cross platform look and feel (CDE/Motif) on other Unix platforms, such as Solaris or Linux. So this is not guaranteed to return the same look and feel as the system, but it does provide more flexibility. I have not looked at SDK 1.5 (or 5.0 or whatever the heck it is called!) yet, but I am hoping the UIManager has a few more looks to choose from when querying the system, including the GTK+.
[ October 15, 2004: Message edited by: Paul Bourdeaux ]
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
One more thing:

For examination purposes, I don't think it matters if you specify a look and feel or not. I think it makes for a more professional application if you do, but I can't imagine any points being deducted if you do not. Just MHO.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: window decorations - native or Swing