Rectangle alloc = new Rectangle(0, 0, getWidth(), getHeight());
int li = getLeftInset(); int ti = getTopInset();  Rectangle alloc = new Rectangle(li, ti, getWidth()-getRightInset()-li, getHeight()-getBottomInset()-ti);   if (alloc.isEmpty()) return 0;
  protected int calculateBreakPosition(int p0, int p1)  {    Container c = getContainer();    Rectangle alloc = new Rectangle(0, 0, getWidth(), getHeight());        updateMetrics();        try      {        getDocument().getText(p0, p1 - p0, getLineBuffer());      }    catch (BadLocationException ble)      {        // this shouldn't happen        throw new InternalError("Invalid offsets p0: " + p0 + " - p1: " + p1);      }    // 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,                                             true);  }