In a GridLayout container, components are placed in a grid of cells. The statement
cp.setLayout(new GridLayout(r, c));
specifies a GridLayout with r rows and c columns for the content pane cp. By default, there are no gaps between components. Again, if gaps are desired, use the constructor GridLayout(r, c, horizgap, vertgap).
Figure illustrates a GridLayout frame with a grid of three rows and two columns. The GridLayout is an AWT feature, so to abbreviate class names, programs must include the statement
import java.awt.GridLayout;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment