Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘GridBagConstraints.gridy’

AWT GridBagConstraints gridx, gridy on GridBagLayout

About The GridBagConstraints Example

Here, the GridBagLayout comprises of 16 cells. In x axis, we have 4 slots and in y axis we have 4 slots. These together form a grid of 16 cells. The gridx and gridy properties of GridBagConstraints represents these slots. In the above picture you can also see placement of the 9 buttons and how they vary in size.

The properties gridheight & gridwidth tell how many cells a control must cover. The gridwidth property spawns a control horizontally and gridheight property spawns it vertically. In this example, we will create 9 buttons and add it to the AWT Frame window, which is managed by GridBagLayout. Along the way, we will learn about the gridx, gridy, gridwidth and gridheight properties of the GridBagConstraints.

Continue Reading →