GridBagConstraints - weight and weight values

In many books weightx, weightythey are expressed differently:

some say from 0.0 to 1.0 others say from 0 to 100 others say up to 1000

I am very confused.

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

+3
source share
2 answers

I would use the examples that were used in the Swing tutorial on How to use GridBagLayout .

In this context, 1.0 means that when the frame is enlarged, the components get all the extra space. 0.0 means it does not have a place.

+4

, . , .

, , , . , .

+2

Source: https://habr.com/ru/post/1749226/


All Articles