本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}