當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。