Java GridLayoutThe Java GridLayout class is used to arrange the components in a rectangular grid. One component is displayed in each rectangle. Constructors of GridLayout class
Example of GridLayout class: Using GridLayout() ConstructorThe GridLayout() constructor creates only one row. The following example shows the usage of the parameterless constructor. FileName: GridLayoutExample.java Output: Example of GridLayout class: Using GridLayout(int rows, int columns) ConstructorFileName: MyGridLayout.java Output: Example of GridLayout class: Using GridLayout(int rows, int columns, int hgap, int vgap) ConstructorThe following example inserts horizontal and vertical gaps between buttons using the parameterized constructor GridLayout(int rows, int columns, int hgap, int vgap). FileName: GridLayoutExample1.java Output: Next TopicFlowLayout |