import java.awt.*; public class GridLayoutTest extends Frame { public GridLayoutTest() { super("GridLayoutTest"); setLayout(new GridLayout(2,2,1,10)); Label label1 = new Label("a"); add(label1); TextField aein = new TextField("-1",8); add(aein); Label label2 = new Label("b"); add(label2); TextField bein = new TextField("0.28",8); add(bein); } public static void main (String [] args) { GridLayoutTest app = new GridLayoutTest(); app.setLocation(100,100); app.setSize(300,100); app.show(); } }
Das GridLayout eignet sich vor allem, wenn eine Reihe von Benutzereingaben notwendig sind.