question: public Shape paintLayer ( Graphics g , int offs0 , int offs1 , Shape bounds , JTextComponent c , View view ) { g . setColor ( getColor ( ) ) ; if ( offs0 == view . getStartOffset ( ) && offs1 == view . getEndOffset ( ) ) { Rectangle alloc ; if ( bounds instanceof Rectangle ) alloc = ( Rectangle ) bounds ; else alloc = bounds . getBounds ( ) ; paintSquiggle ( g , alloc ) ; return alloc ; } try { Shape shape = view . modelToView ( offs0 , Position . Bias . Forward , offs1 , Position . Bias . Backward , bounds ) ; Rectangle r = ( shape instanceof Rectangle ) ? ( Rectangle ) shape : shape . getBounds ( ) ; paintSquiggle ( g , r ) ; return r ; } catch ( BadLocationException e ) { e . printStackTrace ( ) ; } return null ; }
target:  Paints a portion of a highlight.