Package shapes.common

Examples of shapes.common.Builder


public class Main2 {

  public static void main(String[] args) {
    // (see also shapes.impl.composite.Main)
    // define a complex group of shapes.impl.composite
    Builder builder = new CompositeBuilder();
    builder.startGroup();
      builder.addCircle(20);
      builder.addRectangle(100, 200);
      builder.startGroup();
        builder.addRectangle(50, 30);
        builder.addRectangle(300, 60);
        builder.setFilled(false);
        builder.startPolygon();
          builder.addPoint(50, 50);
          builder.addPoint(60, 100);
          builder.addPoint(100, 110);
          builder.addPoint(120, 60);
        builder.endPolygon();
        builder.setStroke(Color.CYAN);
        builder.addCircle(50);
        builder.setFilled(false);
        builder.setStroke(Color.ORANGE);
        builder.setLocation(100, 200);
      builder.endGroup();
      builder.setFilled(true);
      builder.setStroke(Color.RED);
      builder.setLocation(150, 50);
    builder.endGroup();
    builder.setLocation(50, 100);
    final Shape s = builder.getProduct();
    System.out.println(s.accept(new Size()) + " basic shapes");
   
    // calculate the bounding box
    final Location b = s.accept(new BoundingBox());
    final Rectangle r = (Rectangle) b.getChild();
View Full Code Here


public class Main {

  public static void main(String[] args) {
    // define a complex group of shapes.impl.composite
    Builder builder = new CompositeBuilder();
    builder.startGroup();
      builder.addCircle(20);
      builder.addRectangle(100, 200);
      builder.startGroup();
        builder.addRectangle(50, 30);
        builder.setFilled(true);
        builder.addRectangle(300, 60);
        builder.addCircle(50);
        builder.setFilled(true);
        builder.setStroke(Color.ORANGE);
        builder.setLocation(100, 200);
      builder.endGroup();
      builder.setStroke(Color.RED);
      builder.setLocation(150, 50);
    builder.endGroup();
    builder.setLocation(50, 100);
    final Shape s = builder.getProduct();
    System.out.println(s.accept(new Size()) + " basic shapes");

    // calculate the bounding box
    final Location b = s.accept(new BoundingBox());
    final Rectangle r = (Rectangle) b.getChild();
View Full Code Here

TOP

Related Classes of shapes.common.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.