Java Reference
In-Depth Information
Figure 7-12. SwingSet2 lets you view and interact with Swing components in diverse
look and feel contexts.
When SwingSet2 startsrunning,itpresentsitsGUIbasedonthedefaultMetal(also
known as Java) Look and Feel. However, you can change to another look and feel by
selectingfromtheLook&Feelmenu.Forexample, Figure7-12 reveals SwingSet2 's
GUI after the look and feel has been changed to Nimbus.
Note Unfortunately, the need for brevity restrains me from fully covering Swing
components in this chapter. You'll find additional component coverage in subsequent
chapters and Appendix C.
Revisiting TempVerter
Ipreviouslypresenteda TempVerter applicationthatdemonstratesAWTcontainers,
components,layoutmanagers,andevents. Listing7-6 presentsaSwingversionofthis
Listing 7-6 . Refactoring TempVerter for Swing
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
Search WWH ::

Custom Search