Header javaperspective.com
JavaPerspective.com  >   Intermediate Tutorials  >   5. Graphical User Interfaces  >   5.1. Swing class hierarchy

5.1. Swing class hierarchy
Last updated: 1 February 2013.

The following picture shows the Swing class hierarchy. AWT classes are outlined in red and Swing classes are outlined in blue:

picture showing the Swing class hierarchy

Swing is built on top of AWT, which is the reason why every Swing class inherits an AWT class. As you can see, there is a fair number of Swing classes in the hierarchy.

Yet, at this stage, all you need to know is that there are two kinds of Swing classes: the top-level containers (JApplet, JDialog, JFrame, JWindow) and the GUI elements (the subclasses of JComponent). To be displayed onscreen, a GUI element must be included in a top-level container. In fact, it is the top-level container (and thereby its content) that is displayed. GUI elements alone cannot be visible onscreen.

Typically, building a GUI with Swing consists in creating a top-level container as the root to which GUI elements are added appropriately.

Note that although Swing is not based on native components, top-level containers are heavyweight native components, unlike subclasses of JComponent which are implemented as lightweight GUI elements in pure Java code. Consequently, the Swing top-level containers look different on different systems whereas the subclasses of JComponent tend to look the same on all systems.

The next tutorial will show you how to create and display a top-level container onscreen with the class JFrame.


You are here :  JavaPerspective.com  >   Intermediate Tutorials  >   5. Graphical User Interfaces  >   5.1. Swing class hierarchy
Next tutorial :  JavaPerspective.com  >   Intermediate Tutorials  >   5. Graphical User Interfaces  >   5.2. Your first JFrame

Copyright © 2013. JavaPerspective.com. All rights reserved.  ( Terms | Contact | About ) 
Java is a trademark of Oracle Corporation
Image 1 Image 2 Image 3 Image 4 Image 5 Image 6 Image 7