Program: 49916
Project: 49916
Buggy source:
/** 
 * Initialize components of the GUI Create all the GUI components, set their specific properties and add them to the window. Also add any necessary ActionListeners.
 */
private void initComponents(){
  setLayout(new GridBagLayout());
  GridBagConstraints a=new GridBagConstraints();
  setBorder(BorderFactory.createLoweredBevelBorder());
  final JPanel showPiece=new JPanel();
  showPiece.setLayout(new GridLayout(2,1));
  showPiece.setPreferredSize(new Dimension(50,100));
  showPiece.add(bShowPiece.getSquare(1,1));
  showPiece.add(bShowPiece.getSquare(2,1));
  a.gridx=5;
  a.gridy=1;
  a.gridwidth=1;
  add(showPiece,a);
  changePromote=new JButton("String_Node_Str");
  changePromote.setToolTipText("String_Node_Str");
  changePromote.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      promotion((String)piecesList.getSelectedValue());
    }
  }
);
  bShowPiece.getSquare(1,1).addMouseListener(new MouseListener(){
    @Override public void mousePressed(    MouseEvent arg0){
      if (dragged.getPiece() != bShowPiece.getSquare(1,1).getPiece()) {
        bShowPiece.getSquare(1,1).setBackgroundColor(Square.HIGHLIGHT_COLOR);
        dragged.setPiece(bShowPiece.getSquare(1,1).getPiece());
        bShowPiece.getSquare(2,1).resetColor();
      }
 else {
        dragged.setPiece(null);
        bShowPiece.getSquare(1,1).resetColor();
      }
    }
    @Override public void mouseReleased(    MouseEvent arg0){
    }
    @Override public void mouseExited(    MouseEvent arg0){
    }
    @Override public void mouseEntered(    MouseEvent arg0){
    }
    @Override public void mouseClicked(    MouseEvent arg0){
    }
  }
);
  bShowPiece.getSquare(2,1).addMouseListener(new MouseListener(){
    @Override public void mousePressed(    MouseEvent arg0){
      if (dragged.getPiece() != bShowPiece.getSquare(2,1).getPiece()) {
        bShowPiece.getSquare(2,1).setBackgroundColor(Square.HIGHLIGHT_COLOR);
        dragged.setPiece(bShowPiece.getSquare(2,1).getPiece());
        bShowPiece.getSquare(1,1).resetColor();
      }
 else {
        dragged.setPiece(null);
        bShowPiece.getSquare(2,1).resetColor();
      }
    }
    @Override public void mouseReleased(    MouseEvent arg0){
    }
    @Override public void mouseExited(    MouseEvent arg0){
    }
    @Override public void mouseEntered(    MouseEvent arg0){
    }
    @Override public void mouseClicked(    MouseEvent arg0){
    }
  }
);
  bShowPiece.getSquare(1,1).setBackgroundColor(Color.LIGHT_GRAY);
  bShowPiece.getSquare(2,1).setBackgroundColor(Color.getHSBColor(30,70,70));
  whiteRules.addEndOfGame(new EndOfGame("String_Node_Str",0,"String_Node_Str",false));
  blackRules.addEndOfGame(new EndOfGame("String_Node_Str",0,"String_Node_Str",true));
  a.gridx=1;
  a.gridy=0;
  a.fill=GridBagConstraints.HORIZONTAL;
  a.insets=new Insets(10,10,10,5);
  add(new JLabel("String_Node_Str"),a);
  final JTextField name=new JTextField(25);
  a.gridx=2;
  a.gridy=0;
  a.fill=GridBagConstraints.HORIZONTAL;
  a.insets=new Insets(0,0,0,0);
  add(name,a);
  Board[] temp=new Board[1];
  temp[0]=new Board(8,8,false);
  setupPieces();
  drawBoard(temp,false);
  backButton=new JButton("String_Node_Str");
  backButton.setToolTipText("String_Node_Str");
  backButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      Driver.getInstance().revertPanel();
    }
  }
);
  submitButton=new JButton("String_Node_Str");
  submitButton.setToolTipText("String_Node_Str");
  submitButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      if (name.getText().equals("String_Node_Str") || name.getText().equals("String_Node_Str")) {
        JOptionPane.showMessageDialog(getInstance(),"String_Node_Str");
      }
 else {
        b.setName(name.getText());
        for (        Piece p : whiteTeam) {
          p.setPromotesTo(promotions.get(p.getName()));
        }
        for (        Piece p : blackTeam) {
          p.setPromotesTo(promotions.get(p.getName()));
        }
        int numObjectives=0;
        if (!whiteRules.getObjectiveName().equals("String_Node_Str")) {
          for (          Piece p : whiteTeam) {
            if (p.getName().equals(whiteRules.getObjectiveName()))             numObjectives++;
          }
          if (numObjectives != 1) {
            JOptionPane.showMessageDialog(null,"String_Node_Str");
            return;
          }
        }
        numObjectives=0;
        if (!blackRules.getObjectiveName().equals("String_Node_Str")) {
          for (          Piece p : blackTeam) {
            if (p.getName().equals(blackRules.getObjectiveName()))             numObjectives++;
          }
          if (numObjectives != 1) {
            JOptionPane.showMessageDialog(null,"String_Node_Str");
            return;
          }
        }
        b.whiteTeam=whiteTeam;
        boolean set=false;
        for (        Piece p : whiteTeam) {
          if (p.getName().equals("String_Node_Str")) {
            whiteRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
            set=true;
            break;
          }
        }
        if (!set) {
          whiteRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
        }
        b.blackTeam=blackTeam;
        set=false;
        for (        Piece p : blackTeam) {
          if (p.getName().equals("String_Node_Str")) {
            blackRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
            set=true;
            break;
          }
        }
        if (!set) {
          blackRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
        }
        b.writeFile(whiteRules,blackRules);
        Driver.getInstance().revertPanel();
      }
    }
  }
);
  JButton boardSetup=new JButton("String_Node_Str");
  boardSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") BoardCustomMenu makeObj=new BoardCustomMenu(getInstance(),optionsFrame);
    }
  }
);
  JButton objectivesSetup=new JButton("String_Node_Str");
  objectivesSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") ObjectiveMaker makeObj=new ObjectiveMaker(getInstance(),optionsFrame);
    }
  }
);
  JButton ruleSetup=new JButton("String_Node_Str");
  ruleSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") RuleMaker makeRules=new RuleMaker(getInstance(),optionsFrame);
    }
  }
);
  JButton playerSetup=new JButton("String_Node_Str");
  playerSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") PlayerCustomMenu makeObj=new PlayerCustomMenu(getInstance(),optionsFrame);
    }
  }
);
  JButton pieceSetup=new JButton("String_Node_Str");
  pieceSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") PieceMaker makeObj=new PieceMaker(getInstance(),optionsFrame);
    }
  }
);
  GridBagConstraints c=new GridBagConstraints();
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=1;
  c.gridy=1;
  c.insets=new Insets(5,3,3,3);
  pieceHolder.add(pieceSetup,c);
  c.gridx=0;
  c.gridy=2;
  pieceHolder.add(boardSetup,c);
  c.gridx=0;
  c.gridy=3;
  pieceHolder.add(objectivesSetup,c);
  c.gridx=1;
  c.gridy=3;
  pieceHolder.add(ruleSetup,c);
  c.gridx=1;
  c.gridy=2;
  pieceHolder.add(playerSetup,c);
  JPanel options=new JPanel();
  options.setLayout(new GridBagLayout());
  c.fill=GridBagConstraints.CENTER;
  c.gridx=0;
  c.gridy=1;
  options.add(backButton,c);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=1;
  c.gridy=1;
  options.add(submitButton,c);
  a.gridy=2;
  a.gridx=1;
  a.gridwidth=2;
  a.insets=new Insets(10,0,10,5);
  add(options,a);
  Dimension dimension=Toolkit.getDefaultToolkit().getScreenSize();
  int x=(int)((dimension.getWidth() / 4));
  int y=(int)((dimension.getHeight() / 4));
  Driver.getInstance().setLocation(x,y);
}

Fixed version (ground truth):
/** 
 * Initialize components of the GUI Create all the GUI components, set their specific properties and add them to the window. Also add any necessary ActionListeners.
 */
private void initComponents(){
  setLayout(new GridBagLayout());
  GridBagConstraints a=new GridBagConstraints();
  setBorder(BorderFactory.createLoweredBevelBorder());
  final JPanel showPiece=new JPanel();
  showPiece.setLayout(new GridLayout(2,1));
  showPiece.setPreferredSize(new Dimension(50,100));
  showPiece.add(bShowPiece.getSquare(1,1));
  showPiece.add(bShowPiece.getSquare(2,1));
  a.gridx=5;
  a.gridy=1;
  a.gridwidth=1;
  add(showPiece,a);
  changePromote=new JButton("String_Node_Str");
  changePromote.setToolTipText("String_Node_Str");
  changePromote.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      promotion((String)piecesList.getSelectedValue());
    }
  }
);
  bShowPiece.getSquare(1,1).addMouseListener(new MouseListener(){
    @Override public void mousePressed(    MouseEvent arg0){
      if (dragged.getPiece() != bShowPiece.getSquare(1,1).getPiece()) {
        bShowPiece.getSquare(1,1).setBackgroundColor(Square.HIGHLIGHT_COLOR);
        dragged.setPiece(bShowPiece.getSquare(1,1).getPiece());
        bShowPiece.getSquare(2,1).resetColor();
      }
 else {
        dragged.setPiece(null);
        bShowPiece.getSquare(1,1).resetColor();
      }
    }
    @Override public void mouseReleased(    MouseEvent arg0){
    }
    @Override public void mouseExited(    MouseEvent arg0){
    }
    @Override public void mouseEntered(    MouseEvent arg0){
    }
    @Override public void mouseClicked(    MouseEvent arg0){
    }
  }
);
  bShowPiece.getSquare(2,1).addMouseListener(new MouseListener(){
    @Override public void mousePressed(    MouseEvent arg0){
      if (dragged.getPiece() != bShowPiece.getSquare(2,1).getPiece()) {
        bShowPiece.getSquare(2,1).setBackgroundColor(Square.HIGHLIGHT_COLOR);
        dragged.setPiece(bShowPiece.getSquare(2,1).getPiece());
        bShowPiece.getSquare(1,1).resetColor();
      }
 else {
        dragged.setPiece(null);
        bShowPiece.getSquare(2,1).resetColor();
      }
    }
    @Override public void mouseReleased(    MouseEvent arg0){
    }
    @Override public void mouseExited(    MouseEvent arg0){
    }
    @Override public void mouseEntered(    MouseEvent arg0){
    }
    @Override public void mouseClicked(    MouseEvent arg0){
    }
  }
);
  bShowPiece.getSquare(1,1).setBackgroundColor(Color.LIGHT_GRAY);
  bShowPiece.getSquare(2,1).setBackgroundColor(Color.getHSBColor(30,70,70));
  whiteRules.addEndOfGame(new EndOfGame("String_Node_Str",0,"String_Node_Str",false));
  blackRules.addEndOfGame(new EndOfGame("String_Node_Str",0,"String_Node_Str",true));
  a.gridx=1;
  a.gridy=0;
  a.fill=GridBagConstraints.HORIZONTAL;
  a.insets=new Insets(10,10,10,5);
  add(new JLabel("String_Node_Str"),a);
  final JTextField name=new JTextField(25);
  a.gridx=2;
  a.gridy=0;
  a.fill=GridBagConstraints.HORIZONTAL;
  a.insets=new Insets(0,0,0,0);
  add(name,a);
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      name.requestFocus();
    }
  }
);
  Board[] temp=new Board[1];
  temp[0]=new Board(8,8,false);
  setupPieces();
  drawBoard(temp,false);
  backButton=new JButton("String_Node_Str");
  backButton.setToolTipText("String_Node_Str");
  backButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      Driver.getInstance().revertPanel();
    }
  }
);
  submitButton=new JButton("String_Node_Str");
  submitButton.setToolTipText("String_Node_Str");
  submitButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      if (name.getText().equals("String_Node_Str") || name.getText().equals("String_Node_Str")) {
        JOptionPane.showMessageDialog(getInstance(),"String_Node_Str");
      }
 else {
        b.setName(name.getText());
        for (        Piece p : whiteTeam) {
          p.setPromotesTo(promotions.get(p.getName()));
        }
        for (        Piece p : blackTeam) {
          p.setPromotesTo(promotions.get(p.getName()));
        }
        int numObjectives=0;
        if (!whiteRules.getObjectiveName().equals("String_Node_Str")) {
          for (          Piece p : whiteTeam) {
            if (p.getName().equals(whiteRules.getObjectiveName()))             numObjectives++;
          }
          if (numObjectives != 1) {
            JOptionPane.showMessageDialog(null,"String_Node_Str");
            return;
          }
        }
        numObjectives=0;
        if (!blackRules.getObjectiveName().equals("String_Node_Str")) {
          for (          Piece p : blackTeam) {
            if (p.getName().equals(blackRules.getObjectiveName()))             numObjectives++;
          }
          if (numObjectives != 1) {
            JOptionPane.showMessageDialog(null,"String_Node_Str");
            return;
          }
        }
        b.whiteTeam=whiteTeam;
        boolean set=false;
        for (        Piece p : whiteTeam) {
          if (p.getName().equals("String_Node_Str")) {
            whiteRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
            set=true;
            break;
          }
        }
        if (!set) {
          whiteRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
        }
        b.blackTeam=blackTeam;
        set=false;
        for (        Piece p : blackTeam) {
          if (p.getName().equals("String_Node_Str")) {
            blackRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
            set=true;
            break;
          }
        }
        if (!set) {
          blackRules.setObjectivePiece(new ObjectivePiece("String_Node_Str","String_Node_Str"));
        }
        b.writeFile(whiteRules,blackRules);
        Driver.getInstance().revertPanel();
      }
    }
  }
);
  JButton boardSetup=new JButton("String_Node_Str");
  boardSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") BoardCustomMenu makeObj=new BoardCustomMenu(getInstance(),optionsFrame);
    }
  }
);
  JButton objectivesSetup=new JButton("String_Node_Str");
  objectivesSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") ObjectiveMaker makeObj=new ObjectiveMaker(getInstance(),optionsFrame);
    }
  }
);
  JButton ruleSetup=new JButton("String_Node_Str");
  ruleSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") RuleMaker makeRules=new RuleMaker(getInstance(),optionsFrame);
    }
  }
);
  JButton playerSetup=new JButton("String_Node_Str");
  playerSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") PlayerCustomMenu makeObj=new PlayerCustomMenu(getInstance(),optionsFrame);
    }
  }
);
  JButton pieceSetup=new JButton("String_Node_Str");
  pieceSetup.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      optionsFrame.dispose();
      optionsFrame=new JFrame();
      @SuppressWarnings("String_Node_Str") PieceMaker makeObj=new PieceMaker(getInstance(),optionsFrame);
    }
  }
);
  GridBagConstraints c=new GridBagConstraints();
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=1;
  c.gridy=1;
  c.insets=new Insets(5,3,3,3);
  pieceHolder.add(pieceSetup,c);
  c.gridx=0;
  c.gridy=2;
  pieceHolder.add(boardSetup,c);
  c.gridx=0;
  c.gridy=3;
  pieceHolder.add(objectivesSetup,c);
  c.gridx=1;
  c.gridy=3;
  pieceHolder.add(ruleSetup,c);
  c.gridx=1;
  c.gridy=2;
  pieceHolder.add(playerSetup,c);
  JPanel options=new JPanel();
  options.setLayout(new GridBagLayout());
  c.fill=GridBagConstraints.CENTER;
  c.gridx=0;
  c.gridy=1;
  options.add(submitButton,c);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=1;
  c.gridy=1;
  options.add(backButton,c);
  a.gridy=2;
  a.gridx=1;
  a.gridwidth=2;
  a.insets=new Insets(10,0,10,5);
  add(options,a);
  Dimension dimension=Toolkit.getDefaultToolkit().getScreenSize();
  int x=(int)((dimension.getWidth() / 4));
  int y=(int)((dimension.getHeight() / 4));
  Driver.getInstance().setLocation(x,y);
}