public int getMaxLabelWidth(Graphics2D g) {
    int max = 0;
    for (Label label : this.labels) {
      int w = (int) g.getFontMetrics().getStringBounds(label.getLabel(), g).getWidth();
      if (w > max) max = w;
    }

    return max;
  }
  protected int getMaxLabelHeight(Graphics2D g) {
    int max = 0;
    for (Label label : this.labels) {
      int w = (int) g.getFontMetrics().getStringBounds(label.getLabel(), g).getHeight();
      if (w > max) max = w;
    }

    return max;
  }