@Override
	public void paintRow(Graphics2D g2d, int row, int firstCol, int lastCol,
			int x, int y, int cellWidth, int rowHeight) {

		if ((!translate) || translator == null) {
			ErrorWindow.showErrorWindow(new IllegalStateException("The Amino Acid painter must have a translator set before it can be used to paint"));
			return;
		}
		
		Sequence seq = currentSG.get(row);
		
		setCellSize(cellWidth, rowHeight);
		
		g2d.setFont(font);
		g2d.setColor(Color.black);
		for(int i=firstCol; i<Math.min(lastCol, seq.length()); i++) {
			base[0] = seq.at(i);
			
			if ( (i-frame-2)%3==0 && (i >= (frame+2)) && (i-frame < (currentSG.get(row).length()-2))) {
//				String codon = currentSG.get(row).toString().substring(i-2, i-2+3);
//				if (i<5) {
//					System.out.println("Translating codon at i=" + i + " frame: " + frame + " which is: " + codon);
//				}
				AminoAcid aa = null;
				if (revComp)
					aa = translator.translateRevComp(currentSG.get(row), i-2 );
				else
					aa = translator.translate(currentSG.get(row), i-2 );
				
				if (aa==null) {
					//System.err.println("Could not translate codon.. got null AA");
					
					drawChar(g2d, x+(i)*cellWidth+1, y+rowHeight, cellWidth, row, '?');
				}
				else {
					Color color = aaColors.get(aa);
					g2d.setColor(color);
					g2d.fillRect(x+(i-2)*cellWidth, y, 3*cellWidth, rowHeight);
					
					char c = translator.aaToChar(aa);
					drawChar(g2d, x+(i)*cellWidth+1, y+rowHeight, cellWidth, row, c);	
				}
				
				
			}
				

		}
		
	}