How to change the visibility priority of components?

i have 3(A,B,C) sections on my main window and they cover all of my window. there is no gap between them . it looks like this

https://i.hizliresim.com/E2EDzB.jpg

Each section has its own editor class. In resized method of my pluginEditor i draw them within their bounds like this :

 void MyPlugInAudioProcessorEditor::resized()
 {


auto area = getLocalBounds();

const auto delayGuiArea = area.getWidth() * delayGui.delayGuiWidth_float / windowWidth_float;
const auto reverbGuiArea = area.getWidth() * reverbGui.reverbGuiWidth_float / windowWidth_float;
const auto outputGuiArea = area.getWidth() * outputGui.outputGuiWidth_float / windowWidth_float;
if (reverbGui.rockerButtonSituation == 1)
{
	reverbGui.setBounds(area.removeFromLeft(reverbGuiArea));
	delayGui.setBounds(area.removeFromLeft(delayGuiArea));

	
}
else if (reverbGui.rockerButtonSituation == 0)
{
	delayGui.setBounds(area.removeFromLeft(delayGuiArea));
	reverbGui.setBounds(area.removeFromLeft(reverbGuiArea));

}

outputGui.setBounds(area.removeFromLeft(outputGuiArea));
}

Normally there is a rocker switch on the reverb module which is represented as a yellow rectangle and named as 2 in the pic. Everything about this switch is in the reverb editor. In mainwindow editor i am just checking a flag that is being changed according to that rocker switch situation. And according to flag, reverb and delay sections are going to replace their locations. But since my rocker switch is also moving to right and left. It is really annoying to watch it.

What i am trying to do is moving that rocket switch between delay and reverb sections.(red rectangle named as 1 in pic) So it won’t move. And looks like in order to do that i need to define it or call it from my main editor class an draw it in paint method over the delay and reverb secitons. But whatever i did to bring it front , didn’t work. It stays in the background. I tried tofront and setAlwaysOnTop methods after drawing the rocker switch but again it didn’t work.
What do you suggest me to do ?

There are 2 cases/options if I undertand it correctly

A) your “rocker switch” is a component. just add it and make it visible in your MyPlugInAudioProcessorEditor (and set it on top)

B) your “rocker switch” is not a component, you are just drawing it in the paint method. in that case you have to draw it in Component::paintOverChildren (Graphics&) rather than in Component::paint (Graphics&) if you want it to be on top.

option A is most likely the best choice

Thank you very much :pray:
In my case i think i should choose the second one but it is a bit slow. i will also try to create a rockerButtonComponent(your A ) to test its performance. Again, Thank you very much :pray: