Buggy code:
static int checkStyle ( int style ) { } void claimBottomFreeSpace ( ) { } void claimRightFreeSpace ( ) { } void clearBlockSelection ( boolean reset , boolean sendEvent ) { } void clearSelection ( boolean sendEvent ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } public void copy ( ) { } public void copy ( int clipboardType ) { } boolean copySelection ( int type ) { } public int getAlignment ( ) { } int getAvailableHeightAbove ( int height ) { } int getAvailableHeightBellow ( int height ) { } public Color getMarginColor ( ) { } String getModelDelimitedText ( String text ) { } boolean checkDragDetect ( Event event ) { } void createKeyBindings ( ) { } void createCaretBitmaps ( ) { } public void cut ( ) { } void doAutoScroll ( Event event ) { } void doAutoScroll ( int direction , int distance ) { } void doBackspace ( ) { } void doBlockColumn ( boolean next ) { } void doBlockWord ( boolean next ) { } void doBlockLineVertical ( boolean up ) { } void doBlockLineHorizontal ( boolean end ) { } void doBlockSelection ( boolean sendEvent ) { } void doContent ( char key ) { } void doContentEnd ( ) { } void doContentStart ( ) { } void doCursorPrevious ( ) { } void doCursorNext ( ) { } void doDelete ( ) { } void doDeleteWordNext ( ) { } void doDeleteWordPrevious ( ) { } void doLineDown ( boolean select ) { } void doLineEnd ( ) { } void doLineStart ( ) { } void doLineUp ( boolean select ) { } void doMouseLinkCursor ( ) { } void doMouseLinkCursor ( int x , int y ) { } void doMouseLocationChange ( int x , int y , boolean select ) { } void doMouseSelection ( ) { } int doMouseWordSelect ( int x , int newCaretOffset , int line ) { } void doPageDown ( boolean select , int height ) { } void doPageEnd ( ) { } void doPageStart ( ) { } void doPageUp ( boolean select , int height ) { } void doSelection ( int direction ) { } void doSelectionCursorNext ( ) { } void doSelectionCursorPrevious ( ) { } void doSelectionLineDown ( ) { } void doSelectionLineUp ( ) { } void doSelectionPageDown ( int pixels ) { } void doSelectionPageUp ( int pixels ) { } void doSelectionWordNext ( ) { } void doSelectionWordPrevious ( ) { } void doVisualPrevious ( ) { } void doVisualNext ( ) { } void doWordNext ( ) { } void doWordPrevious ( ) { } void endAutoScroll ( ) { } public Color getBackground ( ) { } public int getBaseline ( ) { } public int getBaseline ( int offset ) { } public boolean getBidiColoring ( ) { } public boolean getBlockSelection ( ) { } Rectangle getBlockSelectonPosition ( ) { } Rectangle getBlockSelectionRectangle ( ) { } String getBlockSelectionText ( String delimiter ) { } int getBottomIndex ( ) { } public int getBottomMargin ( ) { } Rectangle getBoundsAtOffset ( int offset ) { int lineIndex = content . getLineAtOffset ( offset ) ; int lineOffset = content . getOffsetAtLine ( lineIndex ) ; String line = content . getLine ( lineIndex ) ; Rectangle bounds ; if ( ( line . length ( ) ) != 0 ) { int offsetInLine = offset - lineOffset ; TextLayout layout = renderer . getTextLayout ( lineIndex ) ; bounds = layout . getBounds ( offsetInLine , offsetInLine ) ; renderer . disposeTextLayout ( layout ) ; } else { bounds = new Rectangle ( 0 , 0 , 0 , renderer . getLineHeight ( ) ) ; } if ( offset == ( caretOffset ) ) { int lineEnd = lineOffset + ( line . length ( ) ) ; <START_BUG> if ( ( offset == lineEnd ) && ( ( caretAlignment ) == ( StyledText . PREVIOUS_OFFSET_TRAILING ) ) ) { <END_BUG> bounds . width += getCaretWidth ( ) ; } } bounds . x += ( leftMargin ) - ( horizontalScrollOffset ) ; bounds . y += getLinePixel ( lineIndex ) ; return bounds ; } public int getCaretOffset ( ) { } int getCaretWidth ( ) { } Object getClipboardContent ( int clipboardType ) { } int getClusterNext ( int offset , int lineIndex ) { } int getClusterPrevious ( int offset , int lineIndex ) { } public StyledTextContent getContent ( ) { } public boolean getDragDetect ( ) { } public boolean getDoubleClickEnabled ( ) { } public boolean getEditable ( ) { } public Color getForeground ( ) { } int getHorizontalIncrement ( ) { } public int getHorizontalIndex ( ) { } public int getHorizontalPixel ( ) { } public int getIndent ( ) { } public boolean getJustify ( ) { } public int getKeyBinding ( int key ) { } public int getCharCount ( ) { } public String getLine ( int lineIndex ) { } public int getLineAlignment ( int index ) { } public int getLineAtOffset ( int offset ) { } public Color getLineBackground ( int index ) { } public Bullet getLineBullet ( int index ) { } StyledTextEvent getLineBackgroundData ( int lineOffset , String line ) { } public int getLineCount ( ) { } int getLineCountWhole ( ) { } public String getLineDelimiter ( ) { } public int getLineHeight ( ) { } public int getLineHeight ( int offset ) { } public int getLineIndent ( int index ) { } public boolean getLineJustify ( int index ) { } public int getLineSpacing ( ) { } StyledTextEvent getLineStyleData ( int lineOffset , String line ) { } public int getLinePixel ( int lineIndex ) { } public int getLineIndex ( int y ) { }

Fix:
if ( offset == lineEnd ) {