I'm trying to figure out how to do something. I've programmed Java, but haven't used Swing much before.
So I have a setup where I have a Frame as follows:
Code: Select all
--------------------
| Panel1 |
|------------------|
| Panel2 |
| |
|------------------|
| Panel3 |
| |
--------------------
Panel2 and Panel3 are GridBagLayout, and also more or less work as I expect, except for one thing.
They both take up a large amount of space. More than you'd need for the few items in there.
Is there a way to define whether a panel with a GridBagLayout will use the minimum space allowed or take up all the excess space?
Ideally, I need Panel2 to be only as big as necessary to show the info it's got, and Panel3 to take up all the extra space, as it will be dynamically filled, and I don't want Panel2 to be resizing itself based on how full or empty Panel3 is.
Given that Panel2 and Panel3 are going to have irregular-sized tables, I need them both to be GridBagLayout. (3 colums each of different size, although my sample code doesn't have it that way for now).
If it's easier, you can view the source code, which is 75 lines. I tried to make it as human readable and easy to follow as possible.
Thanks.