Rectangle alloc = c.getBounds();
Rectangle alloc = c.isValid() ? c.getBounds() : new Rectangle(c.getPreferredSize()); updateMetrics();
  protected int calculateBreakPosition(int p0, int p1)  {    Container c = getContainer();    Rectangle alloc = c.getBounds();    try      {        getDocument().getText(p0, p1 - p0, getLineBuffer());      }    catch (BadLocationException ble)      {        // this shouldn't happen      }    // FIXME: Should we account for the insets of the container?    if (wordWrap)      return p0             + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x,                                          alloc.x + alloc.width, this, p0);    else      return p0             + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x,                                             alloc.x + alloc.width, this, p0);  }