Objects in Container and getBounds()


I have a container and add some objects to it at different positions (not at 0,0). When I call this.getBounds(), I notice that I get a rectangle big enough to surround my objects ** if they were all positioned at 0,0. Looks like the container is ignoring the relative position of the objects and to adjust the rectangle.

Is there a way to get a bound that surrounds all objects and manually set this new size to the container?


The bounds rectangle should be in global coordinate space already.

Thanks @samme, my issue seems somewhere else, as I was able to get this working based on your example.