• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to fill up empty cells in GridBagLayout

 
Ling Chung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
i have a few panels next to eachother,
one for booking
one for searching
and one for statusmessages
my book and searchpanel contain 4 rows 3 columns so max is
gridx = 2;
gridy = 3;
They both contain a panel that has weighty = 1.0 so when i resize all stays in place and it's only that panel that resizes.
Now i want to add a statuspanel containing two messages statusmessages (e.g. on searchresults etc.) And a message resembling if the client works in local or remote mode.
I can't seem to position the messages so that they are in the same place as the other panels position gridx = 0 and gridy = 0 and the other label positioned at gridx = 0 and gridy = 3...
I could use a BorderLayout but how can i make sure that all stays in place when resizing in my gridbaglayout i used a panel that has weighty = 1.0, but i cannot do this in a BorderLayout.
Can somebody please help me out on this one?
Thanks!!!
[ April 16, 2004: Message edited by: Ling Chung ]
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
err.. im not sure what you mean. maybe it is because i am too sleepy?
but from your title you seem to want to fill some empty cells with components? i don't remember if you can do this with gridbaglayout, but with the box layout you can make lightweight invisible components to add some padding around your other components.
take a read here:
http://java.sun.com/docs/books/tutorial/uiswing/layout/box.html#filler
not sure if that's what you want, but hope it helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic