Composite extends into tree structures to represent part-whole hierarchies. Compositelets clients treat individual objects and compositions of objects uniformly combines objects into a tree structure to represent the "part-whole" hierarchy. C o m p o s I t e makes the use of a single object and a combination object consistent applicabilityyou want to represent part-whole hierarchies of objectsyou want clients to be able to ignore the difference between compositions of objects and individual objects. clients will treat all objects in the composite structure uniformly you want to represent the part of the object-the overall hierarchy you want the user to ignore the differences between the combined object and a single object, the user will use all objects in the composite structure in a unified manner: UML participant component (Graphic) declares the interface for ob Jectsin the composition. implements default behavior for theinterface common to all classes, as appropriate. declares an interface for accessingand managing its child components. (optional) defines an interface foraccessing a component's parent in the recursive structure, and implements it ifthat's appropriate. leaf (Rectangle, Line, Text, etc .) represents leaf objects in thecomposition. A leaf has no c Hillit. defines behavior for primitiveobjects in the composition. composite (Picture) defines behavior for componentshaving children. stores child components. implements child-related operationsin the Component interface. clientmanipulates objects in thecomposition through the Component interface. in the drawing example of the security and transparent security patterns, Line, Circle, and Rectangle belong to Leaf, and only Picture has the add, remove, and getChild methods. Therefore, it is safe for Client calls and will not be abused. However, the Client must clarify which ones are Leaf and which are Composite transparent, leaf also has the add, remove, and getChild methods. Therefore, the client can ignore the leaf nodes and Composite nodes. However, if the node is incorrectly used during running, a running exception is thrown, for example, add a node to a leaf node. During implementation, we can throw a runtime exception in the add, remove, and getChild methods of the leaf node to avoid Client-side error calls. The two implementation methods need to be weighed based on requirements. If you are interested in SWing --- Composite Patterns, see the jdk documentation to identify whether it is a transparent implementation method or a secure implementation method.