// This sample illustrates how to define
  // a custom node shape via the Shape class

  // Create a new shape object
  Shape shape = new Shape(
    new ElementTemplate[]
    {
      new ArcTemplate(0, 0, 100, 100, 0, 360)
    },
    new ElementTemplate[]
    {
      new ArcTemplate(25, 30, 15, 15, 180, 180),
      new ArcTemplate(60, 30, 15, 15, 180, 180),
      new ArcTemplate(30, 60, 40, 15, 0, 180)
    },
    null,
    java.awt.geom.GeneralPath.WIND_NON_ZERO,
    "Happy");

  // Create a node and assign the shape to it
  ShapeNode node = diagram.getFactory().createShapeNode(10, 10, 100, 80);
  node.setShape(Shape.fromId("Happy"));