public Dimension getWrappedSize(Container target) {
    Container parent = SwingUtilities.getUnwrappedParent(target);
    int maxWidth = parent.getWidth() - (parent.getInsets().left + parent.getInsets().right);

    return getDimension(target, maxWidth);
  }
public Dimension getWrappedSize(Container target)