<Swing Dev> SpringLayout equivalent behavior
Alexander Scherbatiy
alexandr.scherbatiy at oracle.com
Fri Apr 24 08:47:10 UTC 2015
On 4/24/2015 11:40 AM, Tadeus Prastowo wrote:
> Hi Alex!
>
> Thank you for the pointer. I have filed the problem there. But sadly, the reporting system is proprietary now that I cannot see my open issue as commonly the case when participating in a free software development like, for example, Ubuntu launchpad.
It has been registered as JDK-8078594 SpringLayout equivalent behavior
https://bugs.openjdk.java.net/browse/JDK-8078594
Thanks,
Alexandr.
>
> --
> Best regards,
> Eus
>
> 24.04.2015, 15:16, "Alexander Scherbatiy" <alexandr.scherbatiy at oracle.com>:
>> 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