This Java tip demonstrates a method of drawing different shapes on a component using combination of other shapes. The different shapes can be drawn by a developer overwriting the paint() function of the component.

  // Create a new shape
    Area shape = new Area(shape1);
    // Add shape to shape 2
    shape.add(new Area(shape2));
    // Subtract shape with shape 3
    shape.subtract(new Area(shape3));
    shape.intersect(new Area(shape4));
    shape.exclusiveOr(new Area(shape5));