• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding multiple JPanels  RSS feed

 
Stacy Beery
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Evening Everyone, I hope this is a simple question for everyone. I am creating an application using the tabbed pane. Each Tab will have multiple panels. I have successfully produced multiple panels on my first tab within my main java file using a constructor with no problems. Yet, with the complexity of the GUI, I would rather create a more organized way of writing and reading this code then listing all the GUI in one file. I want to create separate classes - one class for each tab, yet I can't seem to add them to my tab in the first file.

my first tab, called Overview, I created a class file:



Inside my main java file, I created an overviewPanel object:



Finally I added it to the tabbed pane inside my constructor:


Yet, now I can't get the panels inside the overviewPanel class to show on the tab. I am expecting something simple I am missing, but I just can't seem to find it. Can someone help me out?

Thanks!!
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you seen the appropriate Java™ Tutorials section?
Why are you subclassing JPanel? That is usually not necessary.There are all sorts of things you haven't told us. Are you adding anything else to those panels? Remember that a panel doesn't look like anything until you add something to it, or draw something on it, which would necessitate subclassing JPanel. What layout are you using? Please supply more details, so we can actually help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!