Program: 75917
Project: 75917
Buggy source:
/** 
 * If the argument is true, make a fill button visible at the upper right.  This button auto-scales the plot. NOTE: The button may infringe on the title space, if the title is long.  In an application, it is preferable to provide a menu with the fill command.  This way, when printing the plot, the printed plot will not have a spurious button.  Thus, this method should be used only by applets, which normally do not have menus. This method should only be called from within the event dispatch thread, since it interacts with swing.
 */
public synchronized void setButtons(boolean visible){
  if (_resetButton == null) {
    URL img=getClass().getResource("String_Node_Str");
    if (img != null) {
      ImageIcon resetIcon=new ImageIcon(img);
      _resetButton=new JButton(resetIcon);
      _resetButton.setBorderPainted(false);
    }
 else {
      _resetButton=new JButton("String_Node_Str");
    }
    _resetButton.setPreferredSize(new Dimension(20,20));
    _resetButton.setToolTipText("String_Node_Str");
    _resetButton.addActionListener(new ButtonListener());
    add(_resetButton);
  }
  _resetButton.setVisible(visible);
  if (_formatButton == null) {
    URL img=getClass().getResource("String_Node_Str");
    if (img != null) {
      ImageIcon formatIcon=new ImageIcon(img);
      _formatButton=new JButton(formatIcon);
      _formatButton.setBorderPainted(false);
    }
 else {
      _formatButton=new JButton("String_Node_Str");
    }
    _formatButton.setPreferredSize(new Dimension(20,20));
    _formatButton.setToolTipText("String_Node_Str");
    _formatButton.addActionListener(new ButtonListener());
    add(_formatButton);
  }
  _formatButton.setVisible(visible);
  if (_fillButton == null) {
    URL img=getClass().getResource("String_Node_Str");
    if (img != null) {
      ImageIcon fillIcon=new ImageIcon(img);
      _fillButton=new JButton(fillIcon);
      _fillButton.setBorderPainted(false);
    }
 else {
      _fillButton=new JButton("String_Node_Str");
    }
    _fillButton.setPreferredSize(new Dimension(20,20));
    _fillButton.setToolTipText("String_Node_Str");
    _fillButton.addActionListener(new ButtonListener());
    add(_fillButton);
  }
  _fillButton.setVisible(visible);
  requestFocus();
}

Fixed version (ground truth):
/** 
 * If the argument is true, make a fill button visible at the upper right.  This button auto-scales the plot. NOTE: The button may infringe on the title space, if the title is long.  In an application, it is preferable to provide a menu with the fill command.  This way, when printing the plot, the printed plot will not have a spurious button.  Thus, this method should be used only by applets, which normally do not have menus. This method should only be called from within the event dispatch thread, since it interacts with swing.
 */
public synchronized void setButtons(boolean visible){
  if (_resetButton == null) {
    URL img=getClass().getResource("String_Node_Str");
    if (img != null) {
      ImageIcon resetIcon=new ImageIcon(img);
      _resetButton=new JButton(resetIcon);
      _resetButton.setBorderPainted(false);
    }
 else {
      _resetButton=new JButton("String_Node_Str");
    }
    _resetButton.setPreferredSize(new Dimension(20,20));
    _resetButton.setToolTipText("String_Node_Str");
    _resetButton.addActionListener(new ButtonListener());
    add(_resetButton);
  }
  _resetButton.setVisible(visible);
  if (_formatButton == null) {
    URL img=getClass().getResource("String_Node_Str");
    if (img != null) {
      ImageIcon formatIcon=new ImageIcon(img);
      _formatButton=new JButton(formatIcon);
      _formatButton.setBorderPainted(false);
    }
 else {
      _formatButton=new JButton("String_Node_Str");
    }
    _formatButton.setPreferredSize(new Dimension(20,20));
    _formatButton.setToolTipText("String_Node_Str");
    _formatButton.addActionListener(new ButtonListener());
    add(_formatButton);
  }
  _formatButton.setVisible(visible);
  if (_fillButton == null) {
    URL img=getClass().getResource("String_Node_Str");
    if (img != null) {
      ImageIcon fillIcon=new ImageIcon(img);
      _fillButton=new JButton(fillIcon);
      _fillButton.setBorderPainted(false);
    }
 else {
      _fillButton=new JButton("String_Node_Str");
    }
    _fillButton.setPreferredSize(new Dimension(20,20));
    _fillButton.setToolTipText("String_Node_Str");
    _fillButton.addActionListener(new ButtonListener());
    add(_fillButton);
  }
  _fillButton.setVisible(visible);
}