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.
我有一个包含 JMenuBar 的框架。如果用户单击“注销”菜单项,我将删除所有框架的内容并使用其他内容对其进行初始化。问题是,如果我打电话
parent.getContentPane().removeAll(); LoginActivity l = new LoginActivity(parent); l.init(); parent.validate();
框架获得了一些其他内容,但来自前一个“视图”的 JMenuBar 仍然在这里。我怎么能摆脱它?
frame.setJMenuBar(null); // this should do the job