A good answer might be:

Three panels, one per pair of label and text field. Vertical BoxLayout is used for the content pane.


Three Panels

That example was similar to the previous program. Here is a section of the program:

  JLabel     lData1  = new JLabel("Data Item 1");
  JTextField txData1 = new JTextField( 7 );
  JPanel     panel1  = new JPanel();
  JLabel     lData2  = new JLabel("Data Item 2");
  JTextField txData2 = new JTextField( 7 );
  JPanel     panel2  = new JPanel();
  JLabel     lData3  = new JLabel("Data Item 3");
  JTextField txData3 = new JTextField( 7 );
  JPanel     panel3  = new JPanel();
  
  public LayoutEg1()  
  { 
    setTitle( "LayoutEg1" );
    panel1.add( lData1 ); panel1.add( txData1 );
    panel2.add( lData2 ); panel2.add( txData2 );
    panel3.add( lData3 ); panel3.add( txData3 );

    getContentPane().setLayout(
        new BoxLayout( getContentPane(), BoxLayout.Y_AXIS ) ); 
    getContentPane().add( panel1 );
    getContentPane().add( panel2 );
    getContentPane().add( panel3 );
    . . . . . .
  }

QUESTION 10:

Now look at the layout at right. Suggest a grouping into panels. Hint: use nested panels for this.