FlowLayout
The HTML invocation:
<applet code=FlowLayoutTest.class codebase=Examples
width=150 height=35>
</applet>
results in applet:
The same applet may be invoked with a different geometry--the layout manager takes care of placing the elements within the region:
<applet code=FlowLayoutTest.class codebase=Examples
width=50 height=90>
</applet>
results in applet:
Corresponding source code:
import java.awt.*;
import java.applet.Applet;
public class FlowLayoutTest extends Applet {
public void init() {
setLayout(new FlowLayout()); // default
add(new Button("B1"));
add(new Button("B2"));
add(new Button("B3"));
}
}
See also How to Use FlowLayout.
Related Magercise(s):