I'm looking for a class in javax.swing or java.awt that gives flexible size to the object. Say that we name this class MyClass. When I add MyClass to MyPanel, it will be shaped with the objects that lie within it. To be more specific, if I draw a Rectangle, MyClass's size will be that of rectangle's, if I draw a circle, MyClass's size will be that of circle's, etc.
So far I've seen some classes but all are rectangular in shape: Container, Canvas, JLayeredPane, etc.
Any suggestions?