Source of NestedPanels.java


  1: import java.awt.*;
  2: import java.applet.Applet;
  3: 
  4: public class NestedPanels extends Applet {
  5:   public NestedPanels () {
  6:     Panel center = new Panel(); 
  7:     center.setLayout(new BorderLayout());
  8:     center.add("South", new Button("south"));
  9:     center.add("North", new Button("north"));
 10:     center.add("East", new Button("east"));
 11:     center.add("West", new Button("west"));
 12:     center.add("Center", new Button("center"));
 13:     
 14:     Panel south = new Panel(); 
 15:     south.setLayout(new FlowLayout()); 
 16:     south.add(new Button("Help")); 
 17:     choice = new Choice();
 18:     choice.addItem("one");
 19:     choice.addItem("two");
 20:     choice.addItem("three");
 21:     choice.addItem("four");
 22:     choice.addItem("five");
 23:     south.add(choice);
 24:     messageBar = new Label("This is a message bar.");  
 25:     south.add(messageBar); 
 26:      
 27:     setLayout(new BorderLayout());
 28:     add("North", new Button("North"));
 29:     add("East", new Button("East"));
 30:     add("West", new Button("West"));    
 31:     add("South", south);
 32:     add("Center", center);
 33:      
 34:   }
 35:    
 36:   protected Label messageBar; 
 37:   protected Choice choice; 
 38: }