-
GridBagLayout
Hello, I'm curious as to how to set the number of rows and columns using the GridBagLayout so I can set my components in the appropriate place. Right now I've created a label and it is appearing right smack in the middle, leading me to believe the default is a 1 row 1 column set up, I may be wrong. How can I change the number of rows and columns and manipulate their sizes?
Thanks.
-
With GridBagLayout I reccomend you use a Swing builder, such as the one in NetBeans. Its just easier.
-
Hi NewtoJava7
to create a new gridlayout use the following
setLayout(new GridLayout(3,1)) this will great a gridlayout of 3 row and 1 colum. The default layou of a container is a boarderlayout so it has a north east south west. if you say west.setLayout(new GridLayout(3,1)) that will change the west portion of the boarder layout to a GridLayout with 3 row and 1 colum