aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Some More GridBagLayout Help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Some More GridBagLayout Help!" Watch "Some More GridBagLayout Help!" New topic
Author

Some More GridBagLayout Help!

Shawn Rieger
Greenhorn

Joined: Sep 05, 2005
Posts: 16
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 ]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
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

Joined: Sep 05, 2005
Posts: 16
Yes, but with GridLayout I can't strech coponent across 2 or more cells can I?
Stephen Boston
Ranch Hand

Joined: Jul 14, 2005
Posts: 165
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 ]

Steve<br /> <br />No matter where you go, there you are.<br /> <br />"My evil self is at the door, and I have no power to stop it."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Some More GridBagLayout Help!