Java Reference
In-Depth Information
Whereas the AWT components rely on the user's operating system to provide the actual
component to a Java program, Swing components are all controlled from within the Java
runtime. The AWT approach is called either the heavyweight or the peered approach; most
Swing components are lightweight or peerless . You'll explore the basics of this approach in
Chapter 4 with the JComponent . Additional features for customizing the look and feel of compo-
nents are discussed in Chapter 20.
Non-AWT Upgraded Components
In addition to offering replacements for all the basic AWT components, the Swing component
set includes twice as many new components.
Note If you're new to Java, just think of all of these components—both the AWT component replacements
and those that were not in the AWT—as one big set of components, versus two distinct sets.
Here's a look at those components that didn't originate in the AWT world:
JPasswordField : This specialized text field is for password entry, as shown in Figure 1-2.
You cannot use cut or copy operations within the component, but you can paste text
into it.
Figure 1-2. The Swing JPasswordField
JEditorPane and JTextPane : These two components provide support for displaying and
editing multiple-attributed content, such as an HTML and RTF viewer. Figure 1-3 shows
a JEditorPane component.
Figure 1-3. The Swing JEditorPane
 
Search WWH ::




Custom Search