protected int drawSequence ( Graphics2D g2D , int y ) { //g2D.drawString(panelName,10,10); g2D . setColor ( SEQUENCE_COLOR ) ; int aminosize = Math . round ( 1 * scale ) ; if ( aminosize < 1 ) aminosize = 1 ; // only draw within the ranges of the Clip Rectangle drawHere = g2D . getClipBounds ( ) ; int startpos = coordManager . getSeqPos ( drawHere . x ) ; //int endpos = coordManager.getSeqPos(drawHere.x+drawHere.width-2); Composite oldComp = g2D . getComposite ( ) ; g2D . setComposite ( AlphaComposite . getInstance ( AlphaComposite . SRC_OVER , 0.8f ) ) ; //logger.info("paint l " + l + " length " + length ); if ( startpos < 0 ) startpos = 999 ; if ( scale > SEQUENCE_SHOW ) { g2D . setColor ( Color . black ) ; //g2D.setColor(SCALE_COLOR); int i = startpos ; // display the actual sequence!; for ( int gap = startpos ; gap < apos . size ( ) ; gap ++ ) { int xpos = coordManager . getPanelPos ( gap ) ; AlignedPosition m = apos . get ( gap ) ; if ( m . getPos ( position ) == - 1 ) { // a gap position g2D . drawString ( "-" , xpos + 1 , y + 2 + DEFAULT_Y_STEP ) ; continue ; } i = m . getPos ( position ) ; // TODO: // color amino acids by hydrophobicity g2D . drawString ( seqArr [ i ] . toString ( ) , xpos + 1 , y + 2 + DEFAULT_Y_STEP ) ; } // in full sequence mode we need abit more space to look nice y += 2 ; } g2D . setComposite ( oldComp ) ; y += DEFAULT_Y_STEP + 2 ; return y ; }
draw the Amino acid sequence