Program: 81551
Project: 81551
Buggy source:
@Override public void paintComponent(Graphics graphics){
  super.paintComponent(graphics);
  Graphics2D g2d=(Graphics2D)graphics;
  Font font=new Font("String_Node_Str",Font.PLAIN,11);
  g2d.setFont(font);
  FontMetrics metrics=g2d.getFontMetrics(font);
  Insets insets=getBorder().getBorderInsets(this);
  RenderingHints rh=new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  rh.put(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
  g2d.setRenderingHints(rh);
  float scaleFactor=this.getWidth() / StrictMath.abs(maxScale - minScale);
  float lowerBound=mean - factor * sd;
  float upperBound=mean + factor * sd;
  int left=StrictMath.round((lowerBound) * scaleFactor);
  left=left < 0 ? insets.left : left;
  int top=insets.top / 2;
  int width=StrictMath.round(2 * factor * sd* scaleFactor);
  width=width > this.getWidth() ? this.getWidth() - insets.left - insets.right : width;
  int height=this.getHeight() - (insets.top / 2 + insets.bottom);
  int middle=StrictMath.round(height / 2 + top + 5);
  g2d.setColor(new Color(165,205,255));
  g2d.drawRect(left,top,width,height);
  g2d.fillRect(left,top,width,height);
  g2d.setColor(new Color(0,0,0));
  String s=HeatMapColorToolBar.format(lowerBound);
  g2d.drawString(s,left + metrics.stringWidth("String_Node_Str"),middle);
  s=HeatMapColorToolBar.format(mean);
  g2d.drawString(s,mean * scaleFactor - metrics.stringWidth(s) / 2,middle);
  s=HeatMapColorToolBar.format(upperBound);
  g2d.drawString(s,upperBound * scaleFactor - metrics.stringWidth(s + "String_Node_Str"),middle);
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics graphics){
  super.paintComponent(graphics);
  Graphics2D g2d=(Graphics2D)graphics;
  Font font=new Font("String_Node_Str",Font.PLAIN,11);
  g2d.setFont(font);
  FontMetrics metrics=g2d.getFontMetrics(font);
  Insets insets=getBorder().getBorderInsets(this);
  RenderingHints rh=new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  rh.put(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
  g2d.setRenderingHints(rh);
  float scaleFactor=this.getWidth() / StrictMath.abs(maxScale - minScale);
  float lowerBound=mean - factor * sd;
  float upperBound=mean + factor * sd;
  int left=StrictMath.round((lowerBound - minScale) * scaleFactor);
  int top=insets.top / 2;
  int width=StrictMath.round(2 * factor * sd* scaleFactor);
  int right=left + width;
  int middle=(left + right) / 2;
  int height=this.getHeight() - (insets.top / 2 + insets.bottom);
  int halfHeight=StrictMath.round(height / 2 + top + 5);
  left=left < 0 ? 0 : left;
  width=width > this.getWidth() ? this.getWidth() : width;
  g2d.setColor(new Color(165,205,255));
  g2d.drawRect(left,top,width,height);
  g2d.fillRect(left,top,width,height);
  g2d.setColor(new Color(0,0,0));
  String s=HeatMapColorToolBar.format(lowerBound);
  g2d.drawString(s,left + metrics.stringWidth("String_Node_Str"),halfHeight);
  s=HeatMapColorToolBar.format(mean);
  g2d.drawString(s,middle - metrics.stringWidth(s) / 2,halfHeight);
  s=HeatMapColorToolBar.format(upperBound);
  g2d.drawString(s,right - metrics.stringWidth(s + "String_Node_Str"),halfHeight);
}