Java Reference
In-Depth Information
and any name you want for the recipient. Invoke the show() method
on your dialog window.
11.
Save, compile, and run the InstantMessageDemo program.
The main() method you added to InstantMessageDialog is strictly for
testing purposes. When you run the program, you should see a dialog
window similar to the one shown in Figure 12.14. To close this dialog
window, you will need to terminate the JVM (press Ctrl+c at the com-
mand prompt).
Figure 12.14
Your InstantMessageDialog should look similar to this one.
Summary
There are two APIs for creating GUI applications in Java: Swing and
AWT. The Swing API uses many of the AWT classes and interfaces.
■■
Components reside in containers. The java.awt.Component class is the
parent class of all AWT components. The java.awt.Container class is the
parent class of all AWT containers and also of all Swing components.
■■
The java.awt.Frame and javax.swing.JFrame classes are used to create a
top-level window.
■■
A container uses a layout manager to determine how the components
are laid out in the container. A container can use any of the available
layout managers.
■■
The common layout managers are FlowLayout, BorderLayout, Grid-
Layout, GridBagLayout, CardLayout, BoxLayout, SpringLayout, and
OverlayLayout.
■■
Swing components are displayed using a Pluggable Look and Feel
(PLAF) that can be changed dynamically.
■■
A panel can be nested within a container. Panels can be nested within
other panels as well to allow greater control of where components are
laid out within a container.
■■
Search WWH ::




Custom Search