0

Hi,

I'm having troubles with my JMenuItems and Jframe. I want that when you click on a JMenuItem the previous JPanel dissapears and the one you clicked for at the JMenuItem will appear. Now, I don't really know how to accomplish this.

Someone said to me I should use the observer design pattern, but I don't know if this will work or not. I did read about the observer pattern and understand what is about. So can this pattern solve my pattern? And how?

Grtz

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by gunjannigam
0

Hi,

I'm having troubles with my JMenuItems and Jframe. I want that when you click on a JMenuItem the previous JPanel dissapears and the one you clicked for at the JMenuItem will appear. Now, I don't really know how to accomplish this.

Someone said to me I should use the observer design pattern, but I don't know if this will work or not. I did read about the observer pattern and understand what is about. So can this pattern solve my pattern? And how?

Grtz

Use CardLayout or either add all your JPanel in your frame and setVisible false for all and use MenuListener to make the required JPanel visible

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.