![]() |
![]() |
![]() |
![]() |
![]() |
|
The flow-layout manager lays out components from left to right, top to bottom, placing as many components in a row as the space allows. The following flow layout places four components in the first row and two in the second:
import javax.swing.*;
import java.awt.*;
public class TestPanel extends JPanel {
public TestPanel () {
setLayout(new FlowLayout());
add(new TestButton("A"));
add(new TestButton("B"));
add(new TestButton("C"));
add(new TestButton("D"));
add(new TestButton("E"));
add(new TestButton("F"));
}
}