Tools of the Trade: SwingX Meets Swing with New and Extended Components
Sun Microsystems sponsors various open source initiatives that simplify writing Swing applications, improve the performance of these applications, and give them a better visual appeal. This sponsorship takes the form of the SwingLabs open source laboratory. SwingLabs is an umbrella project that consists of major subprojects (DataBinding, JDIC, and SwingX are three examples) and minor subprojects such as Deployment and SwingWorker. Some of the code and concepts introduced by these subprojects might become part of future Java platforms.
This article focuses on SwingX, a tools whose features and components enhance the Swing architecture. We’ll begin by showing you how to download and install SwingLabs. Next, we’ll explore the new SwingX date picker and month view components and the extended Swing hyperlink and Tip of the Day dialog box components.
Download and Install SwingLabs
Before you can explore SwingX components, you need to download and install SwingLabs. Point your web browser to the SwingLabs Download SwingLabs Technology web page and click the appropriate link to download the .8 milestone release’s swinglabs-0.8.0-bin.zip distribution file.
After downloading and unzipping the distribution file, begin the installation by moving the unzipped SwingLabs directory structure to an appropriate location on your hard drive. On my Microsoft Windows platform, I moved c:\unzipped\swinglabs-0.8.0-bin\swinglabs to the root directory—my resulting SwingLabs home directory is c:\swinglabs.
My SwingLabs home directory contains a JAR file called swinglabs-0.8.0.jar. This JAR file contains class files for the SwingX, SwingWorker, JDIC, and DataBinding subprojects. Complete the installation by adding this JAR file to your CLASSPATH. Alternatively, because this article explores only SwingX, add swingx-0.8.0.jar (in directory swinglabs\dist) to your CLASSPATH.
After installing SwingLabs, you’ll want to acquaint yourself with its documentation. Accomplish this task by pointing your web browser to the SwingLabs home directory’s README.html file. This file introduces SwingLabs. It also provides links to release notes and Javadoc documentation on the DataBinding, JDIC, SwingWorker, and SwingX APIs.