Demonstrating GridBagLayout

The application in Figs. 22.2122.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.

 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       ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.