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);
}
LightweightSystem.setContents(IFigure figure)操作解析
本文详细解读了LightweightSystem.setContents(IFigure figure)方法,阐述了其核心作用在于将figure放置于LWS的RootFigure中作为唯一子节点。此方法在绘图应用中扮演关键角色,确保了图元的正确呈现。
898

被折叠的 条评论
为什么被折叠?



