Esempio n. 1
0
  /** Calculate the rectangle occupied by the data */
  protected Rectangle getDataRectangle(Graphics g, Rectangle r) {
    Axis a;
    int waxis;
    int x = r.x;
    int y = r.y;
    int width = r.width;
    int height = r.height;

    for (int i = 0; i < axis.size(); i++) {
      a = ((Axis) axis.elementAt(i));

      waxis = a.getAxisWidth(g);

      switch (a.getAxisPos()) {
        case Axis.LEFT:
          x += waxis;
          width -= waxis;
          break;
        case Axis.RIGHT:
          width -= waxis;
          break;
        case Axis.TOP:
          y += waxis;
          height -= waxis;
          break;
        case Axis.BOTTOM:
          height -= waxis;
          break;
      }
    }

    return new Rectangle(x, y, width, height);
  }