The getEnableClusters and setEnableClusters methods of SpringLayout can be used to make diagrams laid out in distinct clusters as shown below.