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:
http:/www.roseindia.net/java/java-tips/GUI/layouts/30gridlayout.shtml
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java Gridlayout
Post your Comment