在运行时更改LayoutConstraint代码名1

在运行时更改LayoutConstraint代码名1,layout,constraints,codenameone,Layout,Constraints,Codenameone,我有一个带有BorderLayout的容器和一个带有LayoutConstraint=“South”的按钮。如何在运行时将其更改为“北”?从容器中删除该组件,然后再次将其添加到北。调用revalidate()或者更好的调用animateLayout() myBorderContainer.removeComponent(button); myBorderContainer.addComponent(BorderLayout.NORTH, button); myBorderContainer.an

我有一个带有BorderLayout的容器和一个带有LayoutConstraint=“South”的按钮。如何在运行时将其更改为“北”?

从容器中删除该组件,然后再次将其添加到北。调用
revalidate()
或者更好的调用
animateLayout()

myBorderContainer.removeComponent(button);
myBorderContainer.addComponent(BorderLayout.NORTH, button);
myBorderContainer.animateLayout(300);