Program: 16697
Project: 16697
Buggy source:
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2D=(Graphics2D)g;
  g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  int startpos=0;
  int endpos=length;
  String summary=multAln.toString();
  g2D.drawString(summary,20,coordManager.getSummaryPos());
  Color significantCol=Color.black;
  g2D.setPaint(significantCol);
  Rectangle sig=new Rectangle(10,10,10,10);
  g2D.fill(sig);
  for (int i=startpos; i < endpos; i++) {
    boolean isGapped=false;
    g2D.setFont(seqFont);
    if (mapSeqToStruct.get(i) != -1)     g2D.setFont(eqFont);
 else     isGapped=true;
    List<Point> points=new ArrayList<Point>();
    for (int str=0; str < size; str++)     points.add(coordManager.getPanelPos(str,i));
    Point p1=points.get(0);
    Point p2=points.get(points.size() - 1);
    for (int str=0; str < size; str++) {
      char c=alnSeq.get(str).charAt(i);
      Color bg=colors[str % colors.length];
      if (!isGapped) {
        if (colorBySimilarity) {
          boolean equal=true;
          boolean similar=true;
          for (int st=0; st < size - 1; st++) {
            char c1=alnSeq.get(st).charAt(i);
            char c2=alnSeq.get(st + 1).charAt(i);
            if (equal && c1 == c2)             continue;
 else             equal=false;
            if (AFPAlignmentDisplay.aaScore(c1,c2) > 0)             continue;
 else             similar=false;
            break;
          }
          if (equal)           bg=COLOR_EQUAL;
 else           if (similar)           bg=COLOR_SIMILAR;
 else           bg=Color.LIGHT_GRAY;
        }
 else         if (colorByAlignmentBlock) {
          int blockNr=MultipleAlignmentTools.getBlockForAligPos(multAln,mapSeqToStruct,i);
          double fraction=(blockNr * 1.0) / (multAln.getBlocks().size() + 1.0);
          bg=ColorUtils.darker(bg,fraction);
        }
        if (isSelected(i))         bg=Color.YELLOW;
        g2D.setPaint(bg);
        Rectangle rec=new Rectangle(points.get(str).x - 1,points.get(str).y - 11,(p2.x - p1.x) + 12,(p2.y - p1.y) / size);
        g2D.fill(rec);
      }
      g2D.setColor(Color.black);
      g2D.drawString(c + "String_Node_Str",points.get(str).x,points.get(str).y);
    }
  }
  int nrLines=length / MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH;
  for (int i=0; i < nrLines + 1; i++) {
    for (int str=0; str < size; str++) {
      Point p1=coordManager.getLegendPosition(i,str);
      int aligPos=i * MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH;
      Atom a1=MultipleAlignmentTools.getAtomForAligPos(multAln,mapSeqToStruct,str,aligPos);
      String label1=JmolTools.getPdbInfo(a1,false);
      g2D.drawString(label1,p1.x,p1.y);
      Point p3=coordManager.getEndLegendPosition(i,str);
      aligPos=i * MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH + MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH - 1;
      if (aligPos > length)       aligPos=length - 1;
      Atom a3=MultipleAlignmentTools.getAtomForAligPos(multAln,mapSeqToStruct,str,aligPos);
      String label3=JmolTools.getPdbInfo(a3,false);
      g2D.drawString(label3,p3.x,p3.y);
    }
  }
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2D=(Graphics2D)g;
  g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  int startpos=0;
  int endpos=length;
  String summary=multAln.toString();
  g2D.drawString(summary,20,coordManager.getSummaryPos());
  Color significantCol=Color.black;
  g2D.setPaint(significantCol);
  Rectangle sig=new Rectangle(10,10,10,10);
  g2D.fill(sig);
  for (int i=startpos; i < endpos; i++) {
    boolean isGapped=false;
    g2D.setFont(seqFont);
    if (mapSeqToStruct.get(i) != -1)     g2D.setFont(eqFont);
 else     isGapped=true;
    List<Point> points=new ArrayList<Point>();
    for (int str=0; str < size; str++)     points.add(coordManager.getPanelPos(str,i));
    Point p1=points.get(0);
    Point p2=points.get(points.size() - 1);
    for (int str=0; str < size; str++) {
      char c=alnSeq.get(str).charAt(i);
      Color bg=jmol.getColorPattelete().getColorPalette(size)[str];
      if (!isGapped) {
        if (colorBySimilarity) {
          boolean equal=true;
          boolean similar=true;
          for (int st=0; st < size - 1; st++) {
            char c1=alnSeq.get(st).charAt(i);
            char c2=alnSeq.get(st + 1).charAt(i);
            if (equal && c1 == c2)             continue;
 else             equal=false;
            if (AFPAlignmentDisplay.aaScore(c1,c2) > 0)             continue;
 else             similar=false;
            break;
          }
          if (equal)           bg=COLOR_EQUAL;
 else           if (similar)           bg=COLOR_SIMILAR;
 else           bg=Color.LIGHT_GRAY;
        }
 else         if (colorByAlignmentBlock) {
          int blockNr=MultipleAlignmentTools.getBlockForAligPos(multAln,mapSeqToStruct,i);
          bg=jmol.getColorPattelete().getColorPalette(multAln.getBlocks().size())[blockNr];
        }
        if (isSelected(i))         bg=Color.YELLOW;
        if (Character.isUpperCase(c) && c != '-') {
          g2D.setPaint(bg);
          Rectangle rec=new Rectangle(points.get(str).x - 1,points.get(str).y - 11,(p2.x - p1.x) + 12,(p2.y - p1.y) / size);
          g2D.fill(rec);
        }
      }
      g2D.setColor(Color.black);
      g2D.drawString(c + "String_Node_Str",points.get(str).x,points.get(str).y);
    }
  }
  int nrLines=length / MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH;
  for (int i=0; i < nrLines + 1; i++) {
    for (int str=0; str < size; str++) {
      Point p1=coordManager.getLegendPosition(i,str);
      int aligPos=i * MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH;
      Atom a1=MultipleAlignmentTools.getAtomForAligPos(multAln,mapSeqToStruct,str,aligPos);
      String label1=JmolTools.getPdbInfo(a1,false);
      g2D.drawString(label1,p1.x,p1.y);
      Point p3=coordManager.getEndLegendPosition(i,str);
      aligPos=i * MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH + MultipleAlignmentCoordManager.DEFAULT_LINE_LENGTH - 1;
      if (aligPos > length)       aligPos=length - 1;
      Atom a3=MultipleAlignmentTools.getAtomForAligPos(multAln,mapSeqToStruct,str,aligPos);
      String label3=JmolTools.getPdbInfo(a3,false);
      g2D.drawString(label3,p3.x,p3.y);
    }
  }
}