Forums Register Login

GridBagLayout problems

+Pie Number of slices to send: Send
Very frustrating, just when you think you get the hang of this layout, it turns around and does the unexpected...
Here's the code:

My results - in the center of the panel, I see a very small JList, right next to it are two labels superimposed on each other, and right next to that, a text field that can take one character.
I've rebuilt this thing from scratch, drawn it out, etc. I can not for the life of me see where this is going wrong.
Could someone give insight into this, I think I've been staring at it too long and my mind's getting muddled.
Thanks
Jason
+Pie Number of slices to send: Send
Threw a bunch of weights in there, and after several repeated efforts, finally got it looking like I want.
Thought weights were just for resizing, but nope, they're extremely important.
[ March 08, 2002: Message edited by: jason adam ]
+Pie Number of slices to send: Send
the documentaion says that in order for the components to work correctly as you want them at least one of them has to have a weightx=1.0 in a row and a weighty=1.0 in height.
if not, they are just all centerd in the middle cause the layout doesnt know how to distribute the size between them.
other than that, it affects how the extra spaced is divided among the components when you resize the container.
+Pie Number of slices to send: Send
Yeah, read that after posting. Or else you get what I had and everything is all jumbled up in the center.
Don't do a lot of GUI programming, think I need to practice more
Thanks for the tip
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 745 times.
Similar Threads
JComboBox not working properly on a GridBagLayout ??
Applet sizing problem
JTextArea problems in GridbagLayout
Container.validate() not working for GridBagLayout
How to apply "GridBagLayout"?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:37:35.