That's what ContainmentLayoutManager.AppletContainer is doing in C++. (cherry picked from commit ce657881)