Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Add Panel to Panel

 
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
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!