Program: 49984
Project: 49984
Buggy source:
/** 
 * Method to set up the piece making window.
 */
public void initComponents(){
  builder=new PieceBuilder();
  setSize(550,875);
  setLayout(new GridBagLayout());
  GridBagConstraints c=new GridBagConstraints();
  Driver.getInstance().setLocationRelativeTo(null);
  JPanel piecePanel=new JPanel();
  piecePanel.setLayout(new GridBagLayout());
  piecePanel.setBorder(BorderFactory.createTitledBorder("String_Node_Str"));
  JPanel namePanel=new JPanel();
  namePanel.setLayout(new FlowLayout());
  namePanel.add(new JLabel("String_Node_Str"));
  final JTextField name=new JTextField(15);
  namePanel.add(name);
  c.gridx=0;
  c.gridy=0;
  piecePanel.add(namePanel,c);
  final ImageIcon temp=new ImageIcon("String_Node_Str");
  temp.setImage(temp.getImage().getScaledInstance(48,48,Image.SCALE_SMOOTH));
  final JPanel lightIconPanel=new JPanel();
  lightIconPanel.setLayout(new FlowLayout());
  final JButton lightIconButton=new JButton();
  lightIconButton.setSize(48,48);
  lightIconButton.setIcon(temp);
  final JButton chooseLightImage=new JButton("String_Node_Str");
  chooseLightImage.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      final JFileChooser fc=new JFileChooser("String_Node_Str");
      int returnVal=fc.showOpenDialog(null);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        ImageIcon icon=makeIcon(fc,builder);
        lightIconButton.setIcon(icon);
        builder.setLightImage(icon);
      }
    }
  }
);
  lightIconPanel.add(chooseLightImage);
  lightIconPanel.add(lightIconButton);
  c.gridx=0;
  c.gridy=2;
  piecePanel.add(lightIconPanel,c);
  final JPanel darkIconPanel=new JPanel();
  darkIconPanel.setLayout(new FlowLayout());
  final JButton darkIconButton=new JButton();
  darkIconButton.setSize(48,48);
  darkIconButton.setIcon(temp);
  final JButton chooseDarkImage=new JButton("String_Node_Str");
  chooseDarkImage.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      final JFileChooser fc=new JFileChooser("String_Node_Str");
      int returnVal=fc.showOpenDialog(null);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        ImageIcon icon=makeIcon(fc,builder);
        darkIconButton.setIcon(icon);
        builder.setDarkImage(icon);
      }
    }
  }
);
  darkIconPanel.add(chooseDarkImage);
  darkIconPanel.add(darkIconButton);
  c.gridx=0;
  c.gridy=3;
  piecePanel.add(darkIconPanel,c);
  final String[] directions=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  final JComboBox dropdown=new JComboBox(directions);
  final JTextField dist=new JTextField(3);
  dist.setToolTipText("String_Node_Str");
  final JTextField knight=new JTextField(2);
  knight.setToolTipText("String_Node_Str");
  knight.setEnabled(false);
  final JTextField knightSecond=new JTextField(2);
  knightSecond.setToolTipText("String_Node_Str");
  knightSecond.setEnabled(false);
  final JCheckBox knightOn=new JCheckBox("String_Node_Str",false);
  knightOn.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent arg0){
      knightLike=!knightLike;
      if (knightLike) {
        knight.setEnabled(true);
        knightSecond.setEnabled(true);
      }
 else {
        knight.setEnabled(false);
        knightSecond.setEnabled(false);
      }
    }
  }
);
  final JCheckBox leaper=new JCheckBox("String_Node_Str",false);
  final JPanel knightMoving=new JPanel();
  knightMoving.setLayout(new FlowLayout());
  knightMoving.add(knight);
  knightMoving.add(new JLabel("String_Node_Str"));
  knightMoving.add(knightSecond);
  final JButton addInstruction=new JButton("String_Node_Str");
  addInstruction.setToolTipText("String_Node_Str");
  addInstruction.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (isIntDist()) {
        if (dropdown.getSelectedItem() != null) {
          builder.addMove(stringToChar((String)dropdown.getSelectedItem()),Integer.parseInt(dist.getText()));
          dropdown.removeItemAt(dropdown.getSelectedIndex());
          dist.setText("String_Node_Str");
        }
      }
    }
    /** 
 * Determine if the user entered a valid integer.
 * @return If the text is a valid integer
 */
    private boolean isIntDist(){
      try {
        Integer.parseInt(dist.getText());
        return true;
      }
 catch (      Exception e) {
        return false;
      }
    }
    /** 
 * Translate a direction string to it's corresponding char.
 * @param s The string to translate
 * @return The char corresponding to the given String.
 */
    private char stringToChar(    String s){
      if (s.equals("String_Node_Str"))       return 'N';
      if (s.equals("String_Node_Str"))       return 'S';
      if (s.equals("String_Node_Str"))       return 'E';
      if (s.equals("String_Node_Str"))       return 'W';
      if (s.equals("String_Node_Str"))       return 'R';
      if (s.equals("String_Node_Str"))       return 'L';
      if (s.equals("String_Node_Str"))       return 'r';
 else       return 'l';
    }
  }
);
  c.gridx=0;
  c.gridy=4;
  piecePanel.add(addInstruction,c);
  JPanel movementSetup=new JPanel();
  movementSetup.setLayout(new BoxLayout(movementSetup,BoxLayout.Y_AXIS));
  movementSetup.setLayout(new GridBagLayout());
  c.insets=new Insets(5,0,5,0);
  c.gridx=0;
  c.gridy=0;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=1;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=1;
  c.gridy=1;
  movementSetup.add(dropdown,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=2;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=1;
  c.gridy=2;
  movementSetup.add(dist,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=3;
  c.gridwidth=3;
  movementSetup.add(addInstruction,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=5;
  movementSetup.add(leaper,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=6;
  movementSetup.add(knightOn,c);
  c.insets=new Insets(5,0,5,0);
  c.gridx=0;
  c.gridy=7;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.gridx=0;
  c.gridy=8;
  movementSetup.add(knightMoving,c);
  c.gridx=0;
  c.gridy=5;
  piecePanel.add(movementSetup,c);
  final JButton done=new JButton("String_Node_Str");
  done.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      if (name.getText() == "String_Node_Str" || PieceBuilder.isPieceType(name.getText())) {
        JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
        return;
      }
      if (knight.isEnabled()) {
        if (isIntKnights()) {
          builder.addMove('x',Integer.parseInt(knight.getText()));
          builder.addMove('y',Integer.parseInt(knightSecond.getText()));
        }
      }
      builder.setName(name.getText());
      PieceBuilder.savePieceType(builder);
      name.setText("String_Node_Str");
      lightIconButton.setIcon(temp);
      darkIconButton.setIcon(temp);
      dist.setText("String_Node_Str");
      leaper.setSelected(false);
      knightOn.setSelected(false);
      knight.setText("String_Node_Str");
      knight.setEnabled(false);
      knightSecond.setText("String_Node_Str");
      knightSecond.setEnabled(false);
      dropdown.removeAllItems();
      for (int i=0; i < directions.length; i++)       dropdown.addItem(directions[i]);
    }
    /** 
 * Determine if the user entered a valid integer.
 * @return If the text is a valid integer
 */
    private boolean isIntKnights(){
      try {
        Integer.parseInt(knight.getText());
        Integer.parseInt(knightSecond.getText());
        return true;
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
);
  final JButton help=new JButton("String_Node_Str");
  help.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent arg0){
      JOptionPane.showMessageDialog(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",1);
    }
  }
);
  final JButton next=new JButton("String_Node_Str");
  next.setToolTipText("String_Node_Str");
  next.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (name.getText().equals("String_Node_Str")) {
        Driver.getInstance().setPanel(new ObjectiveMaker(b));
      }
 else {
        int answer=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
        if (answer == 0)         Driver.getInstance().setPanel(new ObjectiveMaker(b));
      }
    }
  }
);
  final JButton cancel=new JButton("String_Node_Str");
  cancel.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      Driver.getInstance().setPanel(new BoardCustomMenu(b));
    }
  }
);
  JPanel buttons=new JPanel();
  buttons.setLayout(new FlowLayout());
  buttons.add(help);
  buttons.add(done);
  c.gridx=0;
  c.gridy=7;
  piecePanel.add(buttons,c);
  c.gridx=0;
  c.gridy=0;
  add(piecePanel,c);
  JPanel mainButtons=new JPanel();
  mainButtons.setLayout(new FlowLayout());
  c.gridx=0;
  c.gridy=1;
  mainButtons.add(cancel,c);
  c.gridx=1;
  c.gridy=1;
  mainButtons.add(next,c);
  c.gridx=0;
  c.gridy=1;
  add(mainButtons,c);
}

Fixed version (ground truth):
/** 
 * Method to set up the piece making window.
 */
public void initComponents(){
  builder=new PieceBuilder();
  setSize(550,875);
  setLayout(new GridBagLayout());
  GridBagConstraints c=new GridBagConstraints();
  JPanel piecePanel=new JPanel();
  piecePanel.setLayout(new GridBagLayout());
  piecePanel.setBorder(BorderFactory.createTitledBorder("String_Node_Str"));
  JPanel namePanel=new JPanel();
  namePanel.setLayout(new FlowLayout());
  namePanel.add(new JLabel("String_Node_Str"));
  final JTextField name=new JTextField(15);
  namePanel.add(name);
  c.gridx=0;
  c.gridy=0;
  piecePanel.add(namePanel,c);
  final ImageIcon temp=new ImageIcon("String_Node_Str");
  temp.setImage(temp.getImage().getScaledInstance(48,48,Image.SCALE_SMOOTH));
  final JPanel lightIconPanel=new JPanel();
  lightIconPanel.setLayout(new FlowLayout());
  final JButton lightIconButton=new JButton();
  lightIconButton.setSize(48,48);
  lightIconButton.setIcon(temp);
  final JButton chooseLightImage=new JButton("String_Node_Str");
  chooseLightImage.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      final JFileChooser fc=new JFileChooser("String_Node_Str");
      int returnVal=fc.showOpenDialog(null);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        ImageIcon icon=makeIcon(fc,builder);
        lightIconButton.setIcon(icon);
        builder.setLightImage(icon);
      }
    }
  }
);
  lightIconPanel.add(chooseLightImage);
  lightIconPanel.add(lightIconButton);
  c.gridx=0;
  c.gridy=2;
  piecePanel.add(lightIconPanel,c);
  final JPanel darkIconPanel=new JPanel();
  darkIconPanel.setLayout(new FlowLayout());
  final JButton darkIconButton=new JButton();
  darkIconButton.setSize(48,48);
  darkIconButton.setIcon(temp);
  final JButton chooseDarkImage=new JButton("String_Node_Str");
  chooseDarkImage.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      final JFileChooser fc=new JFileChooser("String_Node_Str");
      int returnVal=fc.showOpenDialog(null);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        ImageIcon icon=makeIcon(fc,builder);
        darkIconButton.setIcon(icon);
        builder.setDarkImage(icon);
      }
    }
  }
);
  darkIconPanel.add(chooseDarkImage);
  darkIconPanel.add(darkIconButton);
  c.gridx=0;
  c.gridy=3;
  piecePanel.add(darkIconPanel,c);
  final String[] directions=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  final JComboBox dropdown=new JComboBox(directions);
  final JTextField dist=new JTextField(3);
  dist.setToolTipText("String_Node_Str");
  final JTextField knight=new JTextField(2);
  knight.setToolTipText("String_Node_Str");
  knight.setEnabled(false);
  final JTextField knightSecond=new JTextField(2);
  knightSecond.setToolTipText("String_Node_Str");
  knightSecond.setEnabled(false);
  final JCheckBox knightOn=new JCheckBox("String_Node_Str",false);
  knightOn.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent arg0){
      knightLike=!knightLike;
      if (knightLike) {
        knight.setEnabled(true);
        knightSecond.setEnabled(true);
      }
 else {
        knight.setEnabled(false);
        knightSecond.setEnabled(false);
      }
    }
  }
);
  final JCheckBox leaper=new JCheckBox("String_Node_Str",false);
  final JPanel knightMoving=new JPanel();
  knightMoving.setLayout(new FlowLayout());
  knightMoving.add(knight);
  knightMoving.add(new JLabel("String_Node_Str"));
  knightMoving.add(knightSecond);
  final JButton addInstruction=new JButton("String_Node_Str");
  addInstruction.setToolTipText("String_Node_Str");
  addInstruction.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (isIntDist()) {
        if (dropdown.getSelectedItem() != null) {
          builder.addMove(stringToChar((String)dropdown.getSelectedItem()),Integer.parseInt(dist.getText()));
          dropdown.removeItemAt(dropdown.getSelectedIndex());
          dist.setText("String_Node_Str");
        }
      }
    }
    /** 
 * Determine if the user entered a valid integer.
 * @return If the text is a valid integer
 */
    private boolean isIntDist(){
      try {
        Integer.parseInt(dist.getText());
        return true;
      }
 catch (      Exception e) {
        return false;
      }
    }
    /** 
 * Translate a direction string to it's corresponding char.
 * @param s The string to translate
 * @return The char corresponding to the given String.
 */
    private char stringToChar(    String s){
      if (s.equals("String_Node_Str"))       return 'N';
      if (s.equals("String_Node_Str"))       return 'S';
      if (s.equals("String_Node_Str"))       return 'E';
      if (s.equals("String_Node_Str"))       return 'W';
      if (s.equals("String_Node_Str"))       return 'R';
      if (s.equals("String_Node_Str"))       return 'L';
      if (s.equals("String_Node_Str"))       return 'r';
 else       return 'l';
    }
  }
);
  c.gridx=0;
  c.gridy=4;
  piecePanel.add(addInstruction,c);
  JPanel movementSetup=new JPanel();
  movementSetup.setLayout(new BoxLayout(movementSetup,BoxLayout.Y_AXIS));
  movementSetup.setLayout(new GridBagLayout());
  c.insets=new Insets(5,0,5,0);
  c.gridx=0;
  c.gridy=0;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=1;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=1;
  c.gridy=1;
  movementSetup.add(dropdown,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=2;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=1;
  c.gridy=2;
  movementSetup.add(dist,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=3;
  c.gridwidth=3;
  movementSetup.add(addInstruction,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=5;
  movementSetup.add(leaper,c);
  c.insets=new Insets(5,0,0,0);
  c.gridx=0;
  c.gridy=6;
  movementSetup.add(knightOn,c);
  c.insets=new Insets(5,0,5,0);
  c.gridx=0;
  c.gridy=7;
  movementSetup.add(new JLabel("String_Node_Str"),c);
  c.gridx=0;
  c.gridy=8;
  movementSetup.add(knightMoving,c);
  c.gridx=0;
  c.gridy=5;
  piecePanel.add(movementSetup,c);
  final JButton done=new JButton("String_Node_Str");
  done.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      if (name.getText() == "String_Node_Str" || PieceBuilder.isPieceType(name.getText())) {
        JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
        return;
      }
      if (knight.isEnabled()) {
        if (isIntKnights()) {
          builder.addMove('x',Integer.parseInt(knight.getText()));
          builder.addMove('y',Integer.parseInt(knightSecond.getText()));
        }
      }
      builder.setName(name.getText());
      PieceBuilder.savePieceType(builder);
      name.setText("String_Node_Str");
      lightIconButton.setIcon(temp);
      darkIconButton.setIcon(temp);
      dist.setText("String_Node_Str");
      leaper.setSelected(false);
      knightOn.setSelected(false);
      knight.setText("String_Node_Str");
      knight.setEnabled(false);
      knightSecond.setText("String_Node_Str");
      knightSecond.setEnabled(false);
      dropdown.removeAllItems();
      for (int i=0; i < directions.length; i++)       dropdown.addItem(directions[i]);
    }
    /** 
 * Determine if the user entered a valid integer.
 * @return If the text is a valid integer
 */
    private boolean isIntKnights(){
      try {
        Integer.parseInt(knight.getText());
        Integer.parseInt(knightSecond.getText());
        return true;
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
);
  final JButton help=new JButton("String_Node_Str");
  help.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent arg0){
      JOptionPane.showMessageDialog(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",1);
    }
  }
);
  final JButton next=new JButton("String_Node_Str");
  next.setToolTipText("String_Node_Str");
  next.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (name.getText().equals("String_Node_Str")) {
        Driver.getInstance().setPanel(new ObjectiveMaker(b));
      }
 else {
        int answer=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
        if (answer == 0)         Driver.getInstance().setPanel(new ObjectiveMaker(b));
      }
    }
  }
);
  final JButton cancel=new JButton("String_Node_Str");
  cancel.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      Driver.getInstance().setPanel(new BoardCustomMenu(b));
    }
  }
);
  JPanel buttons=new JPanel();
  buttons.setLayout(new FlowLayout());
  buttons.add(help);
  buttons.add(done);
  c.gridx=0;
  c.gridy=7;
  piecePanel.add(buttons,c);
  c.gridx=0;
  c.gridy=0;
  add(piecePanel,c);
  JPanel mainButtons=new JPanel();
  mainButtons.setLayout(new FlowLayout());
  c.gridx=0;
  c.gridy=1;
  mainButtons.add(cancel,c);
  c.gridx=1;
  c.gridy=1;
  mainButtons.add(next,c);
  c.gridx=0;
  c.gridy=1;
  add(mainButtons,c);
}