private void addControls() {
   layer.addChild(k1 = PPath.createEllipse(0, 0, DIAM / 2, DIAM / 2));
   layer.addChild(k2 = PPath.createEllipse(0, 0, DIAM / 2, DIAM / 2));
   k1.setStrokePaint(lightBlue);
   k2.setStrokePaint(lightBlue);
   k1.setPickable(false);
   k2.setPickable(false);
 }
 private void addEnds() {
   layer.addChild(n1 = PPath.createEllipse(0, 0, DIAM, DIAM));
   layer.addChild(n2 = PPath.createEllipse(0, 0, DIAM, DIAM));
   n1.setStrokePaint(veryLightGray);
   n2.setStrokePaint(veryLightGray);
   n1.setPickable(false);
   n2.setPickable(false);
   n1.offset(0, 225);
   n2.offset(0, 325);
 }
  public void initialize() {
    final PComposite composite = new PComposite();

    final PNode circle = PPath.createEllipse(0, 0, 100, 100);
    final PNode rectangle = PPath.createRectangle(50, 50, 100, 100);
    final PNode text = new PText("Hello world!");

    composite.addChild(circle);
    composite.addChild(rectangle);
    composite.addChild(text);

    rectangle.rotate(Math.toRadians(45));
    rectangle.setPaint(Color.RED);

    text.scale(2.0);
    text.setPaint(Color.GREEN);

    getCanvas().getLayer().addChild(composite);
    getCanvas().removeInputEventListener(getCanvas().getPanEventHandler());
    getCanvas().addInputEventListener(new PDragEventHandler());
  }