This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding a JPanel Form  RSS feed

 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!