Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding a JPanel Form

 
Scott Tobias
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a Desktop application in Netbeans 6.1 using Matisse. It consists of a JFrame which contains 4 JPanels including one called leftPanel1 So far life is easy.

Now I Create a new JPanel Form again using Matisse. Its called leftPanel2 Thats easy too.

Now, what I want to happen is that when a user selects a menu item, leftPanel1 is replaced by leftPanel2.

I want to add a mousereleased event to the menu item which effects this change, but I cant figure out how to change the JPanel in the JFrame.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make life easier for you

create another panel, set as a cardLayout, add left1 and left2 to
the cardLayoutpanel, then show the one you want

http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic