28

有什么方法可以删除Component添加到CENTERaJPanel的 a BorderLayout,而不必引用它Component本身?

4

1 回答 1

49

像这样的东西?

BorderLayout layout = (BorderLayout)panel.getLayout();
panel.remove(layout.getLayoutComponent(BorderLayout.CENTER));
于 2009-04-17T07:21:48.167 回答