Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有 BorderLayout 的容器和一个带有 LayoutConstraint =“South”的按钮。如何在运行时将其更改为“North”?
从容器中移除组件并再次将其添加到北方。打电话revalidate()或更好,animateLayout()例如
revalidate()
animateLayout()
myBorderContainer.removeComponent(button); myBorderContainer.addComponent(BorderLayout.NORTH, button); myBorderContainer.animateLayout(300);