Program: 180037
Project: 180037
Buggy source:
public void paint(Graphics2D g){
  frame.setBackground(ColorManager.backgroundColor);
  tablep.getSelection();
  Dimension size;
  size=this.getSize();
  Graphics2D bg;
  if (!printing) {
    bi=createImage(size.width,size.height);
    bg=(Graphics2D)bi.getGraphics();
  }
 else   bg=g;
  create(border,border,size.width - border,size.height - border,"String_Node_Str");
  String titletext="String_Node_Str";
  for (int i=0; i < k; i++) {
    if (i < k - 1 && i != maxLevel - 1)     titletext+=names[i] + "String_Node_Str";
 else     titletext+=names[i];
    if (i + 1 == maxLevel && maxLevel < k)     titletext+="String_Node_Str";
  }
  if (maxLevel < k)   titletext+="String_Node_Str";
 else   titletext+="String_Node_Str";
  frame.setTitle(titletext);
  if (displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str")) {
    if (!printing)     bg.setColor(new Color(1.0F,1.0F,1.0F,0.2F));
 else     bg.setColor(new Color(0.95F,0.95F,0.95F,1.0F));
    for (int i=0; i < rects.size(); i++) {
      MyRect r=(MyRect)rects.elementAt(i);
      bg.fillRect(r.x,r.y - r.height + r.h,r.width,r.height);
      bg.drawRect(r.x,r.y - r.height + r.h,r.width,r.height);
    }
  }
  for (int i=0; i < rects.size(); i++) {
    MyRect r=(MyRect)rects.elementAt(i);
    r.setMax(residMax);
    double sum=0, sumh=0;
    for (int j=0; j < r.tileIds.size(); j++) {
      int id=(Integer)(r.tileIds.elementAt(j));
      sumh+=tablep.getSelected(id) * tablep.table[id];
      sum+=tablep.table[id];
    }
    r.setHilite(sumh / sum);
    if (!((displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str")) && sum == 0))     r.draw(bg);
    bg.setColor(Color.black);
  }
  bg.setColor(ColorManager.lineColor);
  if (displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str")|| printing|| showLabels)   for (int i=0; i < Labels.size(); i++) {
    MyText t=(MyText)Labels.elementAt(i);
    t.draw(bg);
  }
  if (!printing) {
    drawSelections(bg);
    g.drawImage(bi,0,0,null);
    bg.dispose();
  }
}

Fixed version (ground truth):
public void paint(Graphics2D g){
  frame.setBackground(ColorManager.backgroundColor);
  tablep.getSelection();
  Dimension size;
  size=this.getSize();
  Graphics2D bg;
  if (!printing) {
    bi=createImage(size.width,size.height);
    bg=(Graphics2D)bi.getGraphics();
  }
 else   bg=g;
  create(border,border,size.width - border,size.height - border,"String_Node_Str");
  String titletext="String_Node_Str";
  for (int i=0; i < k; i++) {
    if (i < k - 1 && i != maxLevel - 1)     titletext+=names[i] + "String_Node_Str";
 else     titletext+=names[i];
    if (i + 1 == maxLevel && maxLevel < k)     titletext+="String_Node_Str";
  }
  if (maxLevel < k)   titletext+="String_Node_Str";
 else   titletext+="String_Node_Str";
  setName(titletext);
  if (displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str")) {
    if (!printing)     bg.setColor(new Color(1.0F,1.0F,1.0F,0.2F));
 else     bg.setColor(new Color(0.95F,0.95F,0.95F,1.0F));
    for (int i=0; i < rects.size(); i++) {
      MyRect r=(MyRect)rects.elementAt(i);
      bg.fillRect(r.x,r.y - r.height + r.h,r.width,r.height);
      bg.drawRect(r.x,r.y - r.height + r.h,r.width,r.height);
    }
  }
  for (int i=0; i < rects.size(); i++) {
    MyRect r=(MyRect)rects.elementAt(i);
    r.setMax(residMax);
    double sum=0, sumh=0;
    for (int j=0; j < r.tileIds.size(); j++) {
      int id=(Integer)(r.tileIds.elementAt(j));
      sumh+=tablep.getSelected(id) * tablep.table[id];
      sum+=tablep.table[id];
    }
    r.setHilite(sumh / sum);
    if (!((displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str")) && sum == 0))     r.draw(bg);
    bg.setColor(Color.black);
  }
  bg.setColor(ColorManager.lineColor);
  if (displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str") || displayMode.equals("String_Node_Str")|| printing|| showLabels)   for (int i=0; i < Labels.size(); i++) {
    MyText t=(MyText)Labels.elementAt(i);
    t.draw(bg);
  }
  if (!printing) {
    drawSelections(bg);
    g.drawImage(bi,0,0,null);
    bg.dispose();
  }
}