• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel inside JFrame  RSS feed

 
Sandesh Jadhav
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Swings. I am working on simple desktop application. My requirement is that I have got a window with Menus in it. On clicking of each menu,I should be able to
display the new set of components. The way I thought is JFrame with menubar set on it. And I will create different classes for each set of components which will extend the JPanel. The functionality of those each of the components set will go into the respective class. And on click event of menu on the JFrame, I'll create the instance of the corresponding class and will add it to the Frame. Also same thing should happen with the clicking of the button, means suppose I click the Next button on one JPanel, I should be able to display the next JPanel. Is there any other simpler way to achieve this?

Thanks in advance...

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your requirement is to change components on some actions.
Check out CardLayout
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandesh Jadhav wrote:I am new to Swings.

I know it's not a big issue, but http://faq.javaranch.com/java/SwingIsAProperNoun
 
Sandesh Jadhav
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Maneesh,

It really worked using CardLayout.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!