Some times we need to create GUI that have a matrix-type layout with columns of same widths and rows of same heights. For this purpose, the layout manager "GridLayout" class, defined in "java.awt" package, is used that lays out components in different equally sized rectangular cells.
You can set number of columns and number of rows by it's constructor GridLayout(int rows, int cols) or by methods setRows() and setColumns(). You can also set horizontal and vertical gaps with its constructor GridLayout(int rows, int cols, int hgap, int vgap) or by methods setHgap(int hgap) and setVgap(int vgap).
Read more at:
Posted on: November 11, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles