Program: 81538
Project: 81538
Buggy source:
/** 
 * {@inheritDoc} 
 */
@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);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@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);
  if (left < 0) {
    width+=left;
    left=0;
  }
  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);
}