tags:

views:

15

answers:

2

In many books weightx and weighty values are expressed in different ways:

some says 0.0 to 1.0 other says 0 to 100 other say until 1000

I'm a lot confused.

In the API these variables are double types so I think the first is correct but what does it meaning a value of 0.4 or 0.7? are percentage values, point values? relative of what?

+2  A: 

Actually, these are weights. So what counts is that they are all on the same "scale".

It doesn't really matter then if percentage or not, in the end, they are evaluated regarding their total on a dimension. So just use what seems to be the most clear for you.

Gnoupi
+2  A: 

I would follow the examples used in the Swing tutorial on How to Use GridBagLayout.

In that context 1.0 means as the frame grows the components gets all the extra space. 0.0 means it gets no space.

camickr
+1. Every Swing answer should indeed contain a link to the Swing tutorial :-]
Gnoupi