LightweightSystem.setContents代码解读

来源:互联网 发布:百度云盘网络证书无效 编辑:程序博客网 时间:2024/05/16 01:04
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);
}

原创粉丝点击