4

I have a frame containing a JMenuBar. If the users clicks the "Logout" MenuItem, I would remove all the frame's content and initialize it with other content. The issue is that if I call

parent.getContentPane().removeAll();
LoginActivity l = new LoginActivity(parent);
l.init();
parent.validate();

the frame gets some other content but the JMenuBar from the previous "view" it's still here. How could I get rid of it?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Teo
  • 3,394
  • 11
  • 43
  • 73

1 Answers1

8
frame.setJMenuBar(null);  // this should do the job
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433