Program: 13662
Project: 13662
Buggy source:
public void paint(Graphics g){
  super.paint(g);
  g.setColor(Color.WHITE);
  g.fillRect(0,0,getWidth(),getHeight());
  g.setColor(Color.BLACK);
  int lastY=0;
  double yStart;
  if (minY % yInterval == 0) {
    yStart=minY;
  }
 else {
    yStart=yInterval * (((int)minY / yInterval) + 1);
  }
  int xOffset=0;
  for (double i=yStart; i <= maxY; i+=yInterval) {
    String label="String_Node_Str" + i;
    label=label.replaceAll("String_Node_Str","String_Node_Str");
    int width=g.getFontMetrics().stringWidth(label);
    if (width > xOffset) {
      xOffset=width;
    }
    g.drawString(label,2,getY(i) + (g.getFontMetrics().getAscent() / 2));
  }
  xOffset+=5;
  int titleWidth=g.getFontMetrics().stringWidth(graphTitle);
  g.drawString(graphTitle,(xOffset + ((getWidth() - (xOffset + 10)) / 2)) - (titleWidth / 2),30);
  g.drawLine(xOffset,getHeight() - 40,getWidth() - 10,getHeight() - 40);
  g.drawLine(xOffset,getHeight() - 40,xOffset,40);
  g.drawString(xLabel,(getWidth() / 2) - (g.getFontMetrics().stringWidth(xLabel) / 2),getHeight() - 5);
  int baseWidth=(getWidth() - (xOffset + 10)) / data[0].length;
  if (baseWidth < 1)   baseWidth=1;
  int lastXLabelEnd=0;
  for (int i=0; i < data[0].length; i++) {
    if (i % 2 != 0) {
      g.setColor(new Color(230,230,230));
      g.fillRect(xOffset + (baseWidth * i),40,baseWidth,getHeight() - 80);
    }
    g.setColor(Color.BLACK);
    String baseNumber="String_Node_Str" + xCategories[i];
    int baseNumberWidth=g.getFontMetrics().stringWidth(baseNumber);
    int baseNumberPosition=(baseWidth / 2) + xOffset + (baseWidth * i) - (baseNumberWidth / 2);
    if (baseNumberPosition > lastXLabelEnd) {
      g.drawString(baseNumber,baseNumberPosition,getHeight() - 25);
      lastXLabelEnd=baseNumberPosition + baseNumberWidth + 5;
    }
  }
  g.setColor(new Color(180,180,180));
  for (double i=yStart; i <= maxY; i+=yInterval) {
    g.drawLine(xOffset,getY(i),getWidth() - 10,getY(i));
  }
  g.setColor(Color.BLACK);
  if (g instanceof Graphics2D) {
    ((Graphics2D)g).setStroke(new BasicStroke(2));
    ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  }
  for (int d=0; d < data.length; d++) {
    g.setColor(COLOURS[d % COLOURS.length]);
    lastY=getY(data[d][0]);
    for (int i=1; i < data[d].length; i++) {
      int thisY=getY(data[d][i]);
      g.drawLine((baseWidth / 2) + xOffset + (baseWidth * (i - 1)),lastY,(baseWidth / 2) + xOffset + (baseWidth * i),thisY);
      lastY=thisY;
    }
  }
  if (g instanceof Graphics2D) {
    ((Graphics2D)g).setStroke(new BasicStroke(1));
    ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
  }
  int widestLabel=0;
  for (int t=0; t < xTitles.length; t++) {
    int width=g.getFontMetrics().stringWidth(xTitles[t]);
    if (width > widestLabel)     widestLabel=width;
  }
  widestLabel+=6;
  g.setColor(Color.WHITE);
  g.fillRect((getWidth() - 10) - widestLabel,40,widestLabel,3 + (20 * xTitles.length));
  g.setColor(Color.LIGHT_GRAY);
  g.drawRect((getWidth() - 10) - widestLabel,40,widestLabel,3 + (20 * xTitles.length));
  for (int t=0; t < xTitles.length; t++) {
    g.setColor(COLOURS[t % COLOURS.length]);
    g.drawString(xTitles[t],((getWidth() - 10) - widestLabel) + 3,40 + (20 * (t + 1)));
  }
}

Fixed version (ground truth):
public void paint(Graphics g){
  super.paint(g);
  g.setColor(Color.WHITE);
  g.fillRect(0,0,getWidth(),getHeight());
  g.setColor(Color.BLACK);
  int lastY=0;
  double yStart;
  if (minY % yInterval == 0) {
    yStart=minY;
  }
 else {
    yStart=yInterval * (((int)minY / yInterval) + 1);
  }
  int xOffset=0;
  for (double i=yStart; i <= maxY; i+=yInterval) {
    String label="String_Node_Str" + i;
    label=label.replaceAll("String_Node_Str","String_Node_Str");
    int width=g.getFontMetrics().stringWidth(label);
    if (width > xOffset) {
      xOffset=width;
    }
    g.drawString(label,2,getY(i) + (g.getFontMetrics().getAscent() / 2));
  }
  xOffset+=5;
  int titleWidth=g.getFontMetrics().stringWidth(graphTitle);
  g.drawString(graphTitle,(xOffset + ((getWidth() - (xOffset + 10)) / 2)) - (titleWidth / 2),30);
  g.drawLine(xOffset,getHeight() - 40,getWidth() - 10,getHeight() - 40);
  g.drawLine(xOffset,getHeight() - 40,xOffset,40);
  g.drawString(xLabel,(getWidth() / 2) - (g.getFontMetrics().stringWidth(xLabel) / 2),getHeight() - 5);
  int baseWidth=(getWidth() - (xOffset + 10)) / data[0].length;
  if (baseWidth < 1)   baseWidth=1;
  int lastXLabelEnd=0;
  for (int i=0; i < data[0].length; i++) {
    if (i % 2 != 0) {
      g.setColor(new Color(230,230,230));
      g.fillRect(xOffset + (baseWidth * i),40,baseWidth,getHeight() - 80);
    }
    g.setColor(Color.BLACK);
    String baseNumber="String_Node_Str" + xCategories[i];
    int baseNumberWidth=g.getFontMetrics().stringWidth(baseNumber);
    int baseNumberPosition=(baseWidth / 2) + xOffset + (baseWidth * i) - (baseNumberWidth / 2);
    if (baseNumberPosition > lastXLabelEnd) {
      g.drawString(baseNumber,baseNumberPosition,getHeight() - 25);
      lastXLabelEnd=baseNumberPosition + baseNumberWidth + 5;
    }
  }
  g.setColor(new Color(180,180,180));
  for (double i=yStart; i <= maxY; i+=yInterval) {
    g.drawLine(xOffset,getY(i),getWidth() - 10,getY(i));
  }
  g.setColor(Color.BLACK);
  if (g instanceof Graphics2D) {
    ((Graphics2D)g).setStroke(new BasicStroke(2));
    ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  }
  for (int d=0; d < data.length; d++) {
    g.setColor(COLOURS[d % COLOURS.length]);
    lastY=getY(data[d][0]);
    for (int i=1; i < data[d].length; i++) {
      if (Double.isNaN(data[d][i]))       break;
      int thisY=getY(data[d][i]);
      g.drawLine((baseWidth / 2) + xOffset + (baseWidth * (i - 1)),lastY,(baseWidth / 2) + xOffset + (baseWidth * i),thisY);
      lastY=thisY;
    }
  }
  if (g instanceof Graphics2D) {
    ((Graphics2D)g).setStroke(new BasicStroke(1));
    ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
  }
  int widestLabel=0;
  for (int t=0; t < xTitles.length; t++) {
    int width=g.getFontMetrics().stringWidth(xTitles[t]);
    if (width > widestLabel)     widestLabel=width;
  }
  widestLabel+=6;
  g.setColor(Color.WHITE);
  g.fillRect((getWidth() - 10) - widestLabel,40,widestLabel,3 + (20 * xTitles.length));
  g.setColor(Color.LIGHT_GRAY);
  g.drawRect((getWidth() - 10) - widestLabel,40,widestLabel,3 + (20 * xTitles.length));
  for (int t=0; t < xTitles.length; t++) {
    g.setColor(COLOURS[t % COLOURS.length]);
    g.drawString(xTitles[t],((getWidth() - 10) - widestLabel) + 3,40 + (20 * (t + 1)));
  }
}