If you want to ‘load’ the component, you just add it as you would any other component. You know how to add text editors and buttons to the MainComponent, yes? Well, you just need to do the same with a mycomponent instead.
 First you need to make sure that mycomponent.h is included in MainComponent.h (the main component needs to know what mycomponent is in order to create one in itself). You do that simply with:
at the top of MainComponent.h. Note: That’s the quickest way, ideally you’d use a forward declaration in the .h file, and put the include in the .cpp file - but for ease (for now at least) you can do it in the .h file.
 You want to give your MainComponent a pointer to a mycomponent object. I’m assuming your spelling of mycomponent isn’t using any capital letters - you might want to (for consistency) change it to MyComponent, or it may already be like that - i’m just going from your last post.
class MainComponent : public Component ... etc....
This gives you somewhere to store the component.
 You then simply create the component and store a pointer to it in that variable, and position it in the same way as you’d position the other components. I.e., when you want to create the component, you’d have a line like this:
mycomp = new MyComponent (/*params*/);
Be aware though that it is probably better to keep all your MainComponent subcomponents in an enveloping component. The reason? Well, consider your MainComponent::resized() function. You’ve got your subcomponents arranged there, but you don’t want them to be positioned when you’ve cleared them away… you’d end up with something like:
.... position the rest
You might instead have your subcomponents inside another component - lets say ‘mySubComponentsComponent’. Then you’d just need to position that on MainComponent, and swap it for MyComponent when you need to. That way, you can just have one pointer (e.g. contentComponent), and your resized function will position that - whatever it is. When you initialise your class, you’d create mySubComponentsComponent and store it in contentComponent. Resized would position that (E.g. setBounds (0,0,getWidth(),getHeight());). When you clear your subcomponents, you can remove and delete mySubComponentsComponent, and then add MyComponent by storing its pointer to contentComponent. Resized will then automatically apply to that instead, as its using the same pointer. You might want to ensure a check that the pointer is valid in the resized function.