![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e850. Laying Out Components in a Row or ColumnA horizontal box container arranges the components left-to-right in their preferred sizes. The row of components are vertically centered.// Create horizontal box container Box box = new Box(BoxLayout.X_AXIS); // Here is a another way to create a horizontal box container box = Box.createHorizontalBox(); // Add components box.add(component1); box.add(component2);A vertical box container arranges the components top-to-bottom aligned in their preferred sizes. The column of components are left-aligned. // Create vertical box container box = new Box(BoxLayout.Y_AXIS); // Here is a another way to create a vertical box container box = Box.createVerticalBox(); // Add components box.add(component1); box.add(component2);
e852. Laying Out Components in a Flow (Left-to-Right, Top-to-Bottom) e853. Laying Out Components in a Grid e854. Laying Out Components Using Absolute Coordinates © 2002 Addison-Wesley. |