Element el = getElement(); if (pos < el.getStartOffset() || pos >= el.getEndOffset()) throw new BadLocationException("Illegal offset for this view", pos); Rectangle r = a.getBounds(); Component c = getComponent(); return new Rectangle(r.x, r.y, c.getWidth(), c.getHeight());
int p0 = getStartOffset(); int p1 = getEndOffset(); if (pos >= p0 && pos <= p1) { Rectangle viewRect = a.getBounds(); if (pos == p1) viewRect.x += viewRect.width; viewRect.width = 0; return viewRect; } else throw new BadLocationException("Illegal position", pos);
    public Shape modelToView(int pos, Shape a, Position.Bias b)      throws BadLocationException    {    Element el = getElement();    if (pos < el.getStartOffset() || pos >= el.getEndOffset())      throw new BadLocationException("Illegal offset for this view", pos);    Rectangle r = a.getBounds();    Component c = getComponent();    return new Rectangle(r.x, r.y, c.getWidth(), c.getHeight());    }