Results 1 to 3 of 3

Thread: GridBagLayout

  1. #1
    newtojava7 is offline Member
    Join Date
    Jan 2008
    Rep Power

    Default 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?


  2. #2
    jimm1 is offline Member
    Join Date
    Jan 2008
    South Africa
    Rep Power


    With GridBagLayout I reccomend you use a Swing builder, such as the one in NetBeans. Its just easier.

  3. #3
    Jman is offline Member
    Join Date
    Dec 2007
    Rep Power


    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

Similar Threads

  1. GridBagLayout...please help
    By newtojava7 in forum Advanced Java
    Replies: 1
    Last Post: 02-17-2008, 01:16 AM
  2. Replies: 1
    Last Post: 02-16-2008, 11:43 PM
  3. Need a idea on GridBagLayout
    By ddsuresh in forum AWT / Swing
    Replies: 1
    Last Post: 01-29-2008, 01:32 AM
  4. gridbaglayout
    By newtojava7 in forum New To Java
    Replies: 4
    Last Post: 01-27-2008, 08:03 PM
  5. Problem with GridBagLayout
    By Daniel in forum SWT / JFace
    Replies: 2
    Last Post: 07-01-2007, 06:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts