Method calls between components not working

This little problem has been driving me insane. My main screen contains 2 custom components; let’s call them “A” and “B” for the sake of simplicity. Within component A I have a button with which I would like to remove/replace component B.

To do this I am calling a reference of component B that I have in the main screen class. I then call the removeComponent(componentBReference) method of the layout which contains component B. Unfortunately this does absolutely nothing. I’ve also tried requestRepaint() after the method call and the replaceComponent() method. Not even mainScreenReference.myLayout.setVisible(false) works.

What am I doing wrong or what must I consider?