[英]Going back to previous JPanel
I am trying to navigate back to a JPanel and was unsure of how to do this. 我试图导航回JPanel,不确定如何执行此操作。 Whenever I try to use the following
每当我尝试使用以下
public class RemoveDE extends JPanel {
private JPanel DEadminhome;
public removeDE(){
setVisible(false);
parent.setContentPane(DEadminhome);
setLayout(null);
}
}
I get error: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: adding container's parent to itself " 我收到错误消息: 线程“ AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:将容器的父代添加到自身 “
The snippet above is indicating removeDE is the current JPanel I am on and DEadminhome is the JPanel that I am attempting to navigate back to. 上面的代码段指示removeDE是我所在的当前JPanel,DEadminhome是我尝试导航回的JPanel。
What would be the correct way of going about this? 解决这个问题的正确方法是什么? Any help would be great, thanks in advance!
任何帮助将是巨大的,在此先感谢!
I am trying to navigate back to a JPanel and was unsure of how to do this
我正在尝试导航回JPanel,不确定如何执行此操作
Try using a Card Layout . 尝试使用卡片布局 。 It will help you manage which panel is visible from a group of panels.
它将帮助您管理从一组面板中可见的面板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.