// This sample demonstrates how to
  // apply clustered spring layout to a graph

  // Create the layout object
  SpringLayout layout = new SpringLayout();

  // Adjust the layout attributes 
  layout.setIterations(200);
  layout.setEnableClusters(true);
  layout.setNodeDistance(8);
  layout.setRepulsionFactor(1);
  layout.setMinimizeCrossings(false);

  // Perform the actual arrangement
  layout.arrange(diagram);