SYNOPSIS:
TreeLayout.setSize() throws an UnsupportedOperationException when rendered if it was directly added to a Swing container.
DESCRIPTION:
TreeLayout.setSize() throws an UnsupportedOperationException when rendered, informing me that the "size of TreeLayout is set by vertex spacing in constructor", if it was directly added to a Swing container. What happens is that the Swing event chain calls BasicVisualizationServer.setVisible(), which in turn calls the layout's setSize() method, which in turn will throw the exception. Since this is triggered by Swing's event chain, there is no trivial way to just catch and ignore the exception.
WORKAROUND:
1) Embed the BasicVisualizationServer in a GraphZoomScrollPane.
2) Create a subclass of TreeLayout and overwrite the setSize-method with: public void setSize(Dimension size) { }