File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some More GridBagLayout Help!

 
Shawn Rieger
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but with GridLayout I can't strech coponent across 2 or more cells can I?
 
Stephen Boston
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic