go to previous page   go to home page   go to next page

Answer:

No. You could add the small panels to the frame using FlowLayout as long as you added them in an order that put them where you want. (Actually, you could add the individual components directly to the frame, but the result might not look as nice.)

Code

Here is the relevant section of code for the example:

  public LayoutEg3()  
  { 
    setTitle( "LayoutEg3 Box Alignment" );

    // Add components to the small panels
    panel1.add( lData1 ); panel1.add( txData1 );
    panel2.add( lData2 ); panel2.add( txData2 );
    panel3.add( lData3 ); panel3.add( txData3 );
    panel4.add( lData4 ); panel4.add( txData4 );
    panel5.add( lData5 ); panel5.add( txData5 );
    panel6.add( lData6 ); panel6.add( txData6 );

    // set layout manager for left panel, add three small panels to it
    pnLeft.setLayout( new BoxLayout( pnLeft, BoxLayout.Y_AXIS ) ); 
    pnLeft.add ( panel1 ); pnLeft.add( panel2 ); 
    pnLeft.add ( panel3 ); 
    
    // set layout manager for right panel, add three small panels to it
    pnRight.setLayout( new BoxLayout( pnRight, BoxLayout.Y_AXIS ) ); 
    pnRight.add( panel4); pnRight.add( panel5); 
    pnRight.add( panel6); 

    // add left and right panels to the frame 
    setLayout( new FlowLayout() );
    add( pnLeft  );
    add( pnRight );
    
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );   
  }

QUESTION 14:

May buttons be added to a panel?