Buggy code:
public class SequenceViewWidgetPanel extends JPanel { private static final long serialVersionUID = 7202257250696337753L ; private int xOff = 80 ; private final int yOff = 20 ; private final int yStep = 14 ; private double scale = 1.0 ; private int selected = 0 ; private int maxSeqLen = 1 ; private DSSequenceSet < ? extends DSSequence > sequenceDB = null ; private HashMap < CSSequence , PatternSequenceDisplayUtil > sequencePatternmatches ; private boolean lineView ; private boolean singleSequenceView ; private static final Color SEQUENCEBACKGROUDCOLOR = Color . BLACK ; private static final Color DRECTIONCOLOR = Color . RED ; private double yBasescale ; private int xBaseCols ; private int [ ] eachSeqStartRowNum ; private double xBasescale ; protected int seqXclickPoint = 0 ; private DSSequence selectedSequence ; private JPopupMenu itemListPopup = new JPopupMenu ( ) ; public SequenceViewWidgetPanel ( ) { } public void addMenuItem ( JMenuItem item ) { } public void initialize ( HashMap < CSSequence , PatternSequenceDisplayUtil > patternSeqMatches , DSSequenceSet < ? extends DSSequence > seqDB , boolean isLineView ) { } @ Override public void paintComponent ( Graphics g ) { } private void paintFullView ( Graphics g ) { } private void paintSingleSequence ( Graphics g ) { } private void paintText ( Graphics g ) { } private void drawPattern ( Graphics g , int rowId , int xStart , int length , Rectangle r , Color color , int strandDirection ) { } public void setMaxSeqLen ( int maxSeqLen ) { } public void setSelectedSequence ( DSSequence selectedSequence ) { } private void drawSequence ( Graphics g , int rowId , int seqId , double len ) { } private void drawPattern ( Graphics g , int rowId , int xStart , int length , Rectangle r , Color color ) { } private void drawPattern ( Graphics g , DSSequence hitSeq , int offset , double xscale , double yscale , int yBase , int cols , Color color , PatternLocations pl ) { } private void drawPattern ( Graphics g , DSSequence hitSeq , int offset , int length , double xscale , double yscale , int yBase , int cols , Color color , int strand ) { } public int getSeqXclickPoint ( ) { } public DSSequence getSelectedSequence ( ) { } private int getSeqDx ( int x ) { } public void this_mouseClicked ( final MouseEvent e ) { } private void setMouseMoveParameters ( MouseEvent e ) { } private void setTranslatedParameters ( MouseEvent e ) { } private int getSeqIdInFullView ( int y ) { } private int getSeqId ( int y ) { } private String getTipInfo ( DSSequence sequence , int off ) { String tip = "" + off ; if ( ( sequencePatternmatches ) != null ) { PatternSequenceDisplayUtil psd = sequencePatternmatches . get ( sequence ) ; if ( psd != null ) { TreeSet < PatternLocations > patternsPerSequence = psd . getTreeSet ( ) ; if ( ( patternsPerSequence != null ) && ( ( patternsPerSequence . size ( ) ) > 0 ) ) { for ( PatternLocations pl : patternsPerSequence ) { CSSeqRegistration reg = pl . getRegistration ( ) ; if ( ( ( reg != null ) && ( ( ( reg . x1 ) + 1 ) <= off ) ) && ( ( reg . x2 ) >= off ) ) { int x1 = ( reg . x1 ) + 1 ; <START_BUG> int x2 = ( reg . x1 ) + ( pl . getAscii ( ) . length ( ) ) ; <END_BUG> if ( pl . getPatternType ( ) . equals ( DEFAULTTYPE ) ) { tip = ( ( ( ( ( ( tip + "<seq2seq4repair_space>" ) + ( pl . getAscii ( ) ) ) + "<" ) + x1 ) + "," ) + x2 ) + "><seq2seq4repair_space>" ; } else if ( pl . getPatternType ( ) . equals ( TFTYPE ) ) { tip = ( ( ( ( ( ( tip + "<seq2seq4repair_space>" ) + ( pl . getAscii ( ) ) ) + "<" ) + x1 ) + "," ) + x2 ) + "><seq2seq4repair_space>" ; } } } } } } return tip ; } public void setSingleSequenceView ( boolean singleSequenceView ) { } public void setSequenceDB ( DSSequenceSet < DSSequence > sequenceDB ) { } public void setLineView ( boolean lineView ) { } public void setSeqXclickPoint ( int seqXclickPoint ) { } private int getMaxLabLen ( ) { } }

Fix:
int x2 = reg . x2 ;