Start of Tutorial > Start of Trail > Start of Lesson | Search |
The names of the Swing packages have varied over time. This trail uses the final Swing package names, which generally start withjavax.swing
. If you have code that uses earlier package names, such ascom.sun.java.swing
, then you will need to convert it.This section has two parts:
Between the Beta 2 and Beta 3 releases of Swing 1.1, the names of the Swing packages changed. In Swing 1.1 Beta 2, for example, the main Swing package was calledcom.sun.java.swing
, while in Swing 1.1 Beta 3, the name isjavax.swing
. The same changes occurred between the Beta 4 and RC1 releases of JDK 1.2.Converting the package names is easy, although it can be tedious to do by hand when many source files are involved. Fortunately, the Swing team provides a utility called
PackageRenamer
that converts programs to use the final Swing package names. You can find the program athttp://java.sun.com/products/jfc/PackageRenamer
.The following table shows how the names have changed:
Old Name
(Swing 1.1 Beta 2, JDK 1.2 Beta 4)New, Final Name
(Swing 1.1 [Beta 3 and later], JDK 1.2 RC1)com.sun.java.accessibility
javax.accessibility
com.sun.java.swing
javax.swing
com.sun.java.swing.border
javax.swing.border
com.sun.java.swing.colorchooser
javax.swing.colorchooser
com.sun.java.swing.event
javax.swing.event
com.sun.java.swing.filechooser
javax.swing.filechooser
com.sun.java.swing.plaf
javax.swing.plaf
com.sun.java.swing.plaf.basic
javax.swing.plaf.basic
com.sun.java.swing.plaf.metal
javax.swing.plaf.metal
com.sun.java.swing.plaf.motif
com.sun.java.swing.plaf.motif
(no change)com.sun.java.swing.plaf.multi
javax.swing.plaf.multi
com.sun.java.swing.plaf.windows
com.sun.java.swing.plaf.windows
(no change)com.sun.java.swing.table
javax.swing.table
com.sun.java.swing.text
javax.swing.text
com.sun.java.swing.text.html
javax.swing.text.html
com.sun.java.swing.tree
javax.swing.tree
com.sun.java.swing.undo
javax.swing.undo
com.sun.java.swing.plaf.mac
com.sun.java.swing.plaf.mac
(no change)com.sun.java.accessibility.util
com.sun.java.accessibility.util
(no change)
Note: Thecom.sun.java.swing.plaf.mac
andcom.sun.java.accessibility.util
packages aren't part of the Swing or JDK release. They are distributed separately as part of the Mac OS Look & Feel release and the Accessibility Utilities, respectively. See the JFC Home Page for details.
At various times, the Swing API has used the following package names:
com.sun.java.swing
java.awt.swing
javax.swing
In the end, the core Swing API is under the
javax.swing
package, with some additional Sun-provided packages undercom.sun.java.swing
. The previous table gives details of the final package names. Now let's look at how the names have varied over time.In all the JFC 1.1 releases up through Swing 1.1 Beta 2, the name of the main Swing package was
com.sun.java.swing
. The JFC 1.1 releases were meant to be used with JDK 1.1. There was no built-in JDK 1.2 support for Swing until JDK 1.2 Beta 2.In the JDK 1.2 Beta 2 and Beta 3 releases, the Swing API was in a new package:
java.awt.swing
. However, some of our customers told us that they wanted the Swing package names to be the same in JFC 1.1 and JDK 1.2, so that they would be able to use the exact same code for both releases.As a result, in JDK 1.2 Beta 4 the Swing team moved the main Swing package to
com.sun.java.swing
. Unfortunately, many people didn't like this change. One of the reasons for the discontent was that having a core API in a package that didn't begin with "java" seemed to imply that Swing wasn't a core API.The Swing team reacted by floating a proposal to move the Swing packages to
javax.swing
in both JFC 1.1 and JDK 1.2. The proposal was favorably greeted by the user community, and the new package names were introduced in Swing 1.1 Beta 3 and JDK 1.2 RC1. The right column of the preceding table shows the final package names.
Start of Tutorial > Start of Trail > Start of Lesson | Search |