Example #1
0
  @Override
  public void update() {
    this.defined = false;
    if (!parent1.isDefined()) return;

    Shape2D shape = parent1.getShape();
    if (!(shape instanceof Domain2D)) return;
    Domain2D domain = (Domain2D) shape;

    boundary = domain.getBoundary();
    this.defined = true;
  }
  public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    // TODO: wrong for dist=51, wrong for dist=52
    buffer = ring.buffer(51);

    g2.setColor(Color.CYAN);
    buffer.fill(g2);
    g2.setColor(Color.BLUE);
    buffer.draw(g2);

    g2.setColor(Color.BLACK);
    ring.draw(g2);
  }