• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Adding a JPanel Form

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic