wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Adding a JPanel Form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding a JPanel Form" Watch "Adding a JPanel Form" New topic

Adding a JPanel Form

Scott Tobias

Joined: Sep 19, 2007
Posts: 3
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

Joined: Jun 09, 2003
Posts: 4632
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

I agree. Here's the link: http://aspose.com/file-tools
subject: Adding a JPanel Form
Similar Threads
jpanel into jframe
Dialog box using Netbeans
JMenuBar not using default alignment?
Question from NickyEng
Change JFrame content pane without window resizing