|
Border Layout Manager The BorderLayout manager can be invoked in one of two ways:
In order to display a component, one must "add" it to the appropriate region. Example In the code below, five buttons are created and placed in each of the five possible drawing areas. Run the program to see what is displayed. Try commenting out any one of the add statements to learn what happens when an area is not used. import java.awt.*; import java.applet.*; public class Border extends Applet { public void init () { setLayout(new BorderLayout()); add ("North", new Button("1")); add ("South", new Button("2")); add ("East", new Button("3")); add ("West", new Button("4")); add ("Center", new Button("5")); } } What You'll See |