Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
The Swing package is part of the JavaTM Foundation Classes (JFC) in the Java platform. The JFC encompasses a group of features to help people build GUIs; Swing provides all the components from buttons to split panes and tables.The Swing package was first available as an add-on to JDK 1.1. Prior to the introduction of the Swing package, the Abstract Window Toolkit (AWT) components provided all the UI components in the JDK 1.0 and 1.1 platforms. Although the Java 2 Platform still supports the AWT components, we strongly encourage you to use Swing components instead. You can identify Swing components because their names start with
Note: "Swing" was the code name of the project that developed the new components. Although it's an unofficial name, it's frequently used to refer to the new components and related API. It's immortalized in the package names for the Swing API, which begin withjavax.swing
.J
. The AWT button class, for example, is namedButton
, whereas the Swing button class is namedJButton
. In addition, the AWT components are in thejava.awt
package, whereas the Swing components are in thejavax.swing
package.As a rule, programs should not use "heavyweight" AWT components alongside Swing components. Heavyweight components include all the ready-to-use AWT components, such as
Menu
andScrollPane
, and all components that inherit from the AWTCanvas
andPanel
classes. When Swing components (and all other "lightweight" components) overlap with heavyweight components, the heavyweight component is always painted on top.
To compile and run your Swing programs, we recommend that you use the latest release of the Java 2 Platform downloaded from http://java.sun.com/j2se/. You can run Swing applets in any browser that has the appropriate version of the Java Plug-in.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2001 Sun Microsystems, Inc. All rights reserved.