• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Some More GridBagLayout Help!

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't get the controls to fill out properly. This is what Im going for...



for some reason it fills the controls out as if there were only 3 columns? I don't understand. Even when I make the label occupy col 1 and 2 it does the same thing. AAm I missing something here?



[ September 08, 2005: Message edited by: Shawn Rieger ]

[ September 08, 2005: Message edited by: Shawn Rieger ]

[ September 08, 2005: Message edited by: Shawn Rieger ]
[ September 08, 2005: Message edited by: Shawn Rieger ]
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are adding three components so you will get three apparent columns showing. If you are
going to add components in all five columns somewhere in rows that follow, ie, if there will
be at least one component in each of the "5" columns somewhere in the layout, then
GridBagLayout will size the columns to show the components at their preferred size plus any
additional space as allocated by the judicious use of the weight constraints. If you must
fill out the first row with 5 columns you can add blank labels with or without setting their
preferred size. You might try adding all the components to the layout and then make
adjustemnts as you feel your way toward success. If you want all the cells to be equal width
you might consider using GridLayout for some (each row) or all of the layout.
 
Shawn Rieger
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but with GridLayout I can't strech coponent across 2 or more cells can I?
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure you can. I added your btnInsert button and made it 4 wide on the next row.

Is that what you were looking for?

Steve
[Edit} Sorry I miss read your question. Just ignore this.


[ September 09, 2005: Message edited by: Stephen Boston ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic