Rectangle alloc = c.isValid() ? c.getBounds() : new Rectangle(c.getPreferredSize());
Rectangle alloc = new Rectangle(0, 0, getWidth(), getHeight());
  protected int calculateBreakPosition(int p0, int p1)  {    Container c = getContainer();    Rectangle alloc = c.isValid() ? c.getBounds()                                 : new Rectangle(c.getPreferredSize());    updateMetrics();    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, 0);    else      {      return p0             + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x,                                             alloc.x + alloc.width, this, 0);      }  }