Re: GridBagLayout not behaving as specified



"Axel Hallez" <Axel.Hallez@xxxxxxxx> wrote in message news:f077fo$ml2$1@xxxxxxxxxxxxxxxxxx

First of all, you seem to think that the gridwidth is used to determine the size ratios of the components (eg. a component with gridwidth 2 must be double as wide as one with gridwidth 1).
This is not true. The width of a column is determined by the size of the components in that column.
However, if you have a component with a gridwidth of 2 (or more), gb layout makes sure that the total width of both columns is at least the size of the component. If one of those colums has no other components (that have their anchor in that column) this column is assigned a width of 0 and all of the width of the component is assigned to the other column. This is why the last column in your layout is as wide as the password field.

If there is space left in the container, the remaining space is distributed over the columns. The weights of the columns determines how much extra space is allocated to each column.

As far as I can see, the exact layout you want te achieve is not possible using gridbaglayout. The closest I could get is putting the dbButton next to the password field.

I've changed your code in this sense.

[snip code]

OK thanks Axel for the detailed explanation. I do feel now with this and other posts that a different layout manager is required.

--
And loving it,

-Q
_________________________________________________
Qu0llSixFour@xxxxxxxxx
(Replace the "SixFour" with numbers to email me)

.


Quantcast