Fünf Objekte (Zwei Labels, zwei Buttons und eine Checkbox) werden gemäß dem BorderLayout angeordnet.
import java.awt.*; public class BorderLayoutTest extends Frame { BorderLayoutTest() { super("BorderLayout"); setLayout(new BorderLayout()); Label label1 = new Label("Label1"); add(label1, "East"); Label label2 = new Label("Label2"); add(label2, "South"); Button b1 = new Button("Button1"); add(b1, "West"); Button b2 = new Button("Button2"); add(b2, "North"); Checkbox cb = new Checkbox("Tja"); add (cb, "Center"); } public static void main (String[] arguments) { BorderLayoutTest proggi = new BorderLayoutTest(); proggi.setSize(300,100); proggi.setLocation(100,100); proggi.show(); } }