Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Get ready to Swing (1.0)

The Java look and feel goes Organic -- and it adds a new default, cross-platform look

  • Print
  • Feedback
As you probably already know, the JavaSoft Swing 1.0 component group is set to appear late this month (February 1998). The Swing components are an extension to the Lightweight UI (user interface) Framework, which itself became a part of the Java AWT (Abstract Windowing Toolkit) when JDK 1.1 was introduced. One of the most important features of the Swing component set, which will be fully incorporated with Java 1.2, is its pluggable look-and-feel (L&F) architecture. This feature allows developers to choose from several preset L&Fs, or craft their own custom appearance and behavior for controls.

A look back at the pre-release Swing

The pre-release Swing, announced at the 1997 JavaOne conference and available to developers since July 1997, contains three pre-defined L&Fs:

  • Java (the original cross-platform L&F)
  • Motif
  • Windows 32-style


In the 1.0 release, the Java L&F will be renamed the Organic L&F and will include two color schemes, Santa Fe and Vancouver, not available with the pre-release Java L&F. Users of pre-release version who continue to use this L&F will have to substitute OrganicLookAndFeel for JLFLookAndFeel in code statements.

The Organic L&F, Santa Fe style

The Organic L&F, Vancouver style



The Motif L&F

The Win32-style L&F



Feedback from users of the pre-release versions of Swing (and specifically on the Java L&F) provided the design team with many ways to enhance the Java L&F for Swing 1.0. Following are some of the changes made to the Organic (neé Java) L&F.

  • Color schemes -- The Swing engineers added earth-tone Santa Fe and gray-tone Vancouver Java-looking color schemes to the Organic L&F to satisfy beta users' requests. The L&F encapsulates color information about the current UI into a Theme object, that the application can apply by using the setCurrentTheme() method. Expect Theme objects to encapsulate more than color schemes in future versions of Swing.

  • Tabbed panes -- Also from feedback, Swing engineers changed the appearance of tabs in tabbed-pane windows to better resemble folder or notebook tabs. The tabs no longer shuffle around when you select one (most developers liked it this way). Also, the justified full-width-of-window tab bug has been corrected.

  • Combo boxes -- Even though they retained most of the look of combo boxes, the engineers did make slight design modifications enabling the addition of visual clues so developers will know at a glance whether a combo box can be edited or not.

  • Scroll bars and other enhancements -- Because developers are decidely split on the rollover effect of scroll bars, no scroll bar changes have been implemented at this time. radioButtonMenuItems and checkBoxMenuItems have been enhanced. And sliders now come in filled and unfilled versions.


The Motif and Windows 32-style L&Fs are pretty straightforward. There is a locking method on the Windows L&F that keeps it from working on non-Windows platforms -- Microsoft hasn't granted JavaSoft the rights that would allow Sun to offer the Windows L&F for other platforms.

  • Print
  • Feedback

Resources
  • What is Swing? http://java.sun.com/products/jfc/swingdoc-current/intro.html
  • The Swing toolset http://java.sun.com/products/jfc/swingdoc-current/tool_set.html
  • The Swing Connection online newsletter http://java.sun.com/products/jfc/swingdoc-current/
  • Metal design highlights http://java.sun.com/products/jfc/swingdoc-current/chris_ryan/metal.html
  • Regular JavaWorld columnist, Todd Sundsted, demonstrates the power of Swing's lightweight components in "Put your user interface on a diet" (JavaWorld, March 1997) http://www.javaworld.com/javaworld/jw-03-1998/jw-03-howto.html