当前位置: 首页>>代码示例>>Java>>正文


Java PRoot.addChild方法代码示例

本文整理汇总了Java中org.piccolo2d.PRoot.addChild方法的典型用法代码示例。如果您正苦于以下问题:Java PRoot.addChild方法的具体用法?Java PRoot.addChild怎么用?Java PRoot.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.piccolo2d.PRoot的用法示例。


在下文中一共展示了PRoot.addChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.piccolo2d.PRoot; //导入方法依赖的package包/类
public void initialize() {
    final PRoot root = getCanvas().getRoot();
    final PLayer layer = getCanvas().getLayer();

    final PNode n = PPath.createRectangle(0, 0, 100, 80);
    final PNode sticky = PPath.createRectangle(0, 0, 50, 50);
    PBoundsHandle.addBoundsHandlesTo(n);
    sticky.setPaint(Color.YELLOW);
    PBoundsHandle.addBoundsHandlesTo(sticky);

    layer.addChild(n);
    getCanvas().getCamera().addChild(sticky);

    final PCamera otherCamera = new PCamera();
    otherCamera.addLayer(layer);
    root.addChild(otherCamera);

    final PCanvas other = new PCanvas();
    other.setCamera(otherCamera);
    final PFrame result = new PFrame("TwoCanvasExample", false, other);
    result.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    result.setLocation(500, 100);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:24,代码来源:TwoCanvasExample.java

示例2: createBasicSceneGraph

import org.piccolo2d.PRoot; //导入方法依赖的package包/类
/**
 * Builds the basic scene graph associated with this canvas. Developers may
 * override this method to install their own layers, and cameras.
 * 
 * @return PCamera viewing the freshly created scene
 */
public PCamera createBasicSceneGraph() {
    final PRoot r = new PSWTRoot(this);
    final PLayer l = new PLayer();
    final PCamera c = new PCamera();

    r.addChild(c);
    r.addChild(l);
    c.addLayer(l);

    return c;
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:18,代码来源:PSWTCanvas.java

示例3: createDefaultCamera

import org.piccolo2d.PRoot; //导入方法依赖的package包/类
/**
 * Creates a default scene with 1 root, 1 layer, and 1 PCacheCamera.
 * 
 * @return constructed scene with PCacheCamera
 */
protected PCamera createDefaultCamera() {
    final PRoot r = new PRoot();
    final PLayer l = new PLayer();
    final PCamera c = new PCacheCamera();

    r.addChild(c);
    r.addChild(l);
    c.addLayer(l);

    return c;
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:17,代码来源:PCacheCanvas.java

示例4: createBasicScenegraph

import org.piccolo2d.PRoot; //导入方法依赖的package包/类
/**
 * Creates the simplest possible scene graph. 1 Camera, 1 Layer, 1 Root
 * 
 * @return a basic scene with 1 camera, layer and root
 */
public static PCamera createBasicScenegraph() {
    final PRoot root = new PRoot();
    final PLayer layer = new PLayer();
    final PCamera camera = new PCamera();

    root.addChild(camera);
    root.addChild(layer);
    camera.addLayer(layer);

    return camera;
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:17,代码来源:PUtil.java


注:本文中的org.piccolo2d.PRoot.addChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。