A good answer might be:

Using the Panel's add() method.

Adding Components to a Panel

Use the add() method to place components inside containers, including Panels. When adding a component to a Panel, you need to use the Panel's add() method, which you do using dot notation:

thePanel.add( componentForPanel );

Panels will automatically use the FlowLayout layout manager with the components placed inside of them. Here is part of the fat calculator:

public class percentFat extends Frame implements ActionListener
{
  Label title     = new Label("Percent of Calories from Fat");
  Label fatLabel  = new Label("Enter grams of fat:   ");
  Label calLabel  = new Label("Enter total calories: ");
  Label perLabel  = new Label("Percent calories from fat: ");

  TextField inFat  = new TextField( 7 );
  TextField inCal  = new TextField( 7 );
  TextField outPer = new TextField( 7 );

  Button    doit   = new Button("Do It!");
  
  Panel fatPanel   = new Panel();   // fat input components
  Panel calPanel   = new Panel();   // calorie input components
  Panel perPanel   = new Panel();   // percent fat output components
    
  percentFat()            // constructor
  {  
    setTitle("Calories from Fat");
    setLayout( new FlowLayout() );       // choose the layout manager for the Frame
    
    // add components to the Panels
fatPanel.add( ) ;
fatPanel.add( );
calPanel.add( );
calPanel.add( );
perPanel.add( );
perPanel.add( );
. . . . . . . . }

Decide what two components should be added to each Panel. The order in which they are added does matter. Click on the button to see if you are right.

QUESTION 5:

Now what must be done with the title, the Panels, and the doit Button?

Click Here after you have answered the question