Demonstrating GridBagLayout
The application in Figs. 22.21–22.22 uses the GridBagLayout layout manager to arrange the components of the GUI in Fig. 22.18. The application does nothing except demonstrate how to use GridBagLayout.
Click here to view code image
1 // Fig. 22.21: GridBagFrame.java 2 // Demonstrating GridBagLayout. 3 import java.awt.GridBagLayout; 4 import java.awt.GridBagConstraints; 5 import java.awt.Component; 6 import javax.swing.JFrame; 7 import javax.swing.JTextArea; 8 import javax.swing.JTextField; 9 import javax.swing.JButton;10 import javax.swing.JComboBox;11
12 public class GridBagFrame extends JFrame13 {14 private final GridBagLayout layout; // layout of this frame 15 ...