<Swing Dev> SpringLayout equivalent behavior
Alexander Scherbatiy
alexandr.scherbatiy at oracle.com
Fri Apr 24 08:14:36 UTC 2015
You can create an issue on it: http://bugreport.java.com/bugreport
Thanks,
Alexandr.
On 4/24/2015 11:04 AM, Tadeus Prastowo wrote:
> Hi!
>
> Could someone give me a pointer to where I should ask/file the following Swing layout problem, please?
>
> 20.04.2015, 18:55, "Tadeus Prastowo" <tadeus.prastowo at yandex.com>:
>> Hi!
>>
>> It is shown on https://docs.oracle.com/javase/tutorial/uiswing/layout/spring.html#alternatives that
>>
>> layout.putConstraint(
>> SpringLayout.WEST, label,
>> 5,
>> SpringLayout.WEST, contentPane);
>>
>> is equivalent to
>>
>> SpringLayout.Constraints contentPaneCons = layout.getConstraints(contentPane);
>> contentPaneCons.setX(
>> Spring.sum(
>> Spring.constant(5),
>> contentPaneCons.getConstraint(SpringLayout.WEST)
>> ));
>>
>> IMO, setting the X of a container from within the container will have no effect because the one who will set the container's X will be the layout manager of its parent container. Therefore, I think the correct one is:
>>
>> SpringLayout.Constraints labelCons = layout.getConstraints(label);
>> labelCons.setX(
>> Spring.sum(
>> Spring.constant(5),
>> labelCons.getConstraint(SpringLayout.WEST)
>> ));
>>
>> What do you guys think?
>>
>> Thank you.
>>
>> --
>> Best regards,
>> Eus
More information about the swing-dev
mailing list