public Shape paintLayer(Graphics g,int offs0,int offs1,Shape bounds,JTextComponent c,View view){
  Color color=getColor();
  if (color == null) {
    g.setColor(c.getSelectionColor());
  }
 else {
    g.setColor(color);
  }
  Rectangle r;
  if (offs0 == view.getStartOffset() && offs1 == view.getEndOffset()) {
    if (bounds instanceof Rectangle) {
      r=(Rectangle)bounds;
    }
 else {
      r=bounds.getBounds();
    }
  }
 else {
    try {
      Shape shape=view.modelToView(offs0,Position.Bias.Forward,offs1,Position.Bias.Backward,bounds);
      r=(shape instanceof Rectangle) ? (Rectangle)shape : shape.getBounds();
    }
 catch (    BadLocationException e) {
      r=null;
    }
  }
  if (r != null) {
    r.width=Math.max(r.width,1);
    g.fillRect(r.x,r.y,r.width,r.height);
  }
  return r;
}

public Shape paintLayer ( Graphics g , int offs0 , int offs1 , Shape bounds , JTextComponent c , View view ) { Color color = getColor ( ) ; if ( color == null ) { g . setColor ( c . getSelectionColor ( ) ) ; } else { g . setColor ( color ) ; } Rectangle r ; if ( offs0 == view . getStartOffset ( ) && offs1 == view . getEndOffset ( ) ) { if ( bounds instanceof Rectangle ) { r = ( Rectangle ) bounds ; } else { r = bounds . getBounds ( ) ; } } else { try { Shape shape = view . modelToView ( offs0 , Position . Bias . Forward , offs1 , Position . Bias . Backward , bounds ) ; r = ( shape instanceof Rectangle ) ? ( Rectangle ) shape : shape . getBounds ( ) ; } catch ( BadLocationException e ) { r = null ; } } if ( r != null ) { r . width = Math . max ( r . width , 1 ) ; g . fillRect ( r . x , r . y , r . width , r . height ) ; } return r ; }
paints a portion of a highlight .
