📄 e850. laying out components in a row or column.txt
字号:
A 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);
Related Examples
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -