FlowLayout
流布局用于安排有向流中的组件,这非常类似于段落中的文本行。流的方向取决于容器的 componentOrientation
属性,
ComponentOrientation.LEFT_TO_RIGHT
ComponentOrientation.RIGHT_TO_LEFT
- 流布局一般用来安排面板中的按钮。它使得按钮呈水平放置,直到同一条线上再也没有适合的按钮。线的对齐方式由
align
属性确定。可能的值为:LEFT 左
RIGHT 右
CENTER 居中
LEADING 与容器方向的开始边对齐,例如,对于从左到右的方向,则与左边对齐
TRAILING 与容器方向的结束边对齐,例如,对于从左到右的方向,则与右边对齐
import java.applet.Applet;
public class myButtons extends Applet {
Button button1, button2, button3;
public void init() {
button1 = new Button("Ok");
button2 = new Button("Open");
button3 = new Button("Close");
Label b=new Label("标签");
add(button1);
add(button2);
add(button3);
add(b);
}
}