使用BorderLayout从JPanel中删除CENTER元素 [英] Removing the CENTER element from a JPanel using BorderLayout

查看:951
本文介绍了使用BorderLayout从JPanel中删除CENTER元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法删除组件添加到 JPANel的 CENTER c> , c>

  BorderLayout布局= panel.getLayout(); 
panel.removeLayoutComponent(layout.getLayoutComponent(BorderLayout.CENTER));


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

解决方案

Something like this?

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

这篇关于使用BorderLayout从JPanel中删除CENTER元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆