LightweightSystem.setContents(IFigure figure)) 实际上是将figure放到LWS的RootFigure中,作为RootFigure的唯一孩子。
源代码如下:
源代码如下:
/**
* Sets the contents of the LightweightSystem to the passed figure. This figure should be
* the top-level Figure in a Draw2d application.
*
* @param figure the new root figure
* @since 2.0
*/
public void setContents(IFigure figure) {
if (contents != null)
root.remove(contents);
contents = figure;
root.add(contents);
}