Removing the CENTER element from a JPanel using BorderLayout

前端 未结 1 1816
半阙折子戏
半阙折子戏 2020-12-05 23:23

Is there any way of removing the Component added to the CENTER of a JPanel with a BorderLayout, without having to referen

1条回答
  •  鱼传尺愫
    2020-12-05 23:50

    Something like this?

    BorderLayout layout = (BorderLayout)panel.getLayout();
    panel.remove(layout.getLayoutComponent(BorderLayout.CENTER));
    

    0 讨论(0)
提交回复
热议问题