• Post Reply Bookmark Topic Watch Topic
  • New Topic

Add Panel to Panel  RSS feed

 
Chris Cairns
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you add a panel that's a separate class to a (background) panel that's a different class also?
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
panel is just a component. use:
panel.add(panel);
or provide constraints that conform to the parent panel's layout. for example:
panel.add(panel, BorderLayout.CENTER);
cheers,
Chantal
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi again,
re-reading your post, I suppose you meant how to get the references connected if they are in different classes. you will need some controlling instance that knows both, or the parent panel knows of the child panel. the latter might be the first to go. depends on your design.
the parent panel would have to instantiate the child panel and add it to itself.
cheers
chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!