public Shape paintLayer(Graphics g,int offs0,int offs1,Shape bounds,JTextComponent c,View view){
  Color base=getColor();
  Color color=base != null ? new Color(base.getRed(),base.getGreen(),base.getBlue(),255) : null;
  if (color == null) {
    g.setColor(c.getSelectionColor());
  }
 else {
    g.setColor(color);
  }
  if (offs0 == view.getStartOffset() && offs1 == view.getEndOffset()) {
    Rectangle alloc;
    if (bounds instanceof Rectangle) {
      alloc=(Rectangle)bounds;
    }
 else {
      alloc=bounds.getBounds();
    }
    g.fillRect(alloc.x,alloc.y,c.getWidth() - alloc.x,alloc.height);
  }
 else {
    try {
      Shape shape=view.modelToView(offs0,Position.Bias.Forward,offs1,Position.Bias.Backward,bounds);
      Rectangle r=(shape instanceof Rectangle) ? (Rectangle)shape : shape.getBounds();
      g.fillRect(0,r.y,c.getWidth(),r.height);
      return r;
    }
 catch (    BadLocationException e) {
    }
  }
  return null;
}

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