Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I add a JPanel inside of another JPanel?  RSS feed

 
Matt Wilcko
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can I add a JPanel inside of another JPanel? What I have is a JFrame using BorderLayout. The top half(North) I want to have a status bar(it lists which step the user is in). The bottom half(CENTER) is the work area. For the work area panel, I am using the Card Layout so I can have 5 panels. Each panel is displayed at a different time. The problem I have is, when using this panel with CardLayout inside of another panel, all 5 panels are displayed at once. Thanks in advance for any help!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the answer is... Yes. But it sounds like you know that already...

Make sure you are setting CardLayout on the component that directly holds the 5 panels... it sounds like when you changed stuff the layout didn't get set.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!