@SuppressWarnings("unchecked")
  private void setFormValues() {
    this.savedSpriteComboBox.setEnabled(false);
    this.savedSpriteComboBox.removeAllItems();
    this.savedSpriteComboBox.setEnabled(true);

    gameName.setText(controller.getCurrentGameName());
    Object sprites[] = controller.getAllSpriteNames();
    for (Object sprite : sprites) {
      this.savedSpriteComboBox.addItem(sprite);
    }

    this.savedSpriteComboBox.validate();
  }
  @SuppressWarnings({"unchecked", "rawtypes"})
  private void createForm() {
    collisionEventActionHashMap = new HashMap<String, String>();
    gameName = new JLabel();

    spriteName = new JLabel(LabelNames.FORM2_SPRITE_NAME);
    spriteNameTextBox = new JTextField();

    spriteImageName = new JLabel(LabelNames.FORM2_SPRITE_IMAGE);

    spriteImageComboBox = new JComboBox(controller.getImageFileNames());
    spriteX = new JLabel(LabelNames.FORM2_SPRITE_X);
    spriteXTextBox = new JTextField();
    spriteY = new JLabel(LabelNames.FORM2_SPRITE_Y);
    spriteYTextBox = new JTextField();

    savedSpriteNames = new JLabel(LabelNames.FORM2_SAVED_SPRITE_NAMES);
    savedSpriteComboBox = new JComboBox();
    savedSpriteComboBox.addActionListener(new ComboActionListener());
    keyPressEventForm = new JLabel(LabelNames.FORM2_SPRITE_KEYPRESS_EVENT);
    moveLeft = new JCheckBox(LabelNames.FORM2_SPRITE_KEYPRESS_EVENT_MOVE_LEFT);
    moveRight = new JCheckBox(LabelNames.FORM2_SPRITE_KEYPRESS_EVENT_MOVE_RIGHT);
    moveUp = new JCheckBox(LabelNames.FORM2_SPRITE_KEYPRESS_EVENT_MOVE_UP);
    selfMove = new JCheckBox(ActionName.SELF_MOVE);
    moveDown = new JCheckBox(LabelNames.FORM2_SPRITE_KEYPRESS_EVENT_MOVE_DOWN);

    resetBtn = new JButton(LabelNames.FORM2_SPRITE_RESET_BUTTON);

    saveBtn = new JButton(LabelNames.FORM2_SPRITE_SAVE_BUTTON);
    deleteBtn = new JButton(LabelNames.FORM2_SPRITE_DELETE_BUTTON);
    collisionEventActionBtn =
        new JButton(LabelNames.FORM2_SPRITE_COLLISION_EVENT_ACTION_ADD_BUTTON);
    repeat = new JLabel(LabelNames.FORM2_SPRITE_REPEAT_LABEL);

    // building the list for collision event action pair selection
    String[] collisionEventString = {
      LabelNames.FORM2_SPRITE_BOUNCE_LABEL,
      LabelNames.FORM2_SPRITE_FALL_THROUGH_LABEL,
      LabelNames.FORM2_SPRITE_DISAPPEAR_LABEL
    };

    String[] collisionEventActionString = {GameState.GAME_WIN, GameState.GAME_LOSE, GameState.NONE};

    collisionEventList = new JList(collisionEventString);
    collisionEventActionList = new JList(collisionEventActionString);

    collisionEventActionDisplay = new JTextArea();
    collisionEventActionDisplay.setEditable(false);

    resetBtn.addActionListener(new resetButtonAdapter());
    saveBtn.addActionListener(new saveButtonAdapter());
    deleteBtn.addActionListener(new DeleteButtonAdapter());
    collisionEventActionBtn.addActionListener(new AddCollisionEventActionPairActionListener());

    // Sub panel 1
    // form to get x, y, width, height, image of the sprite
    // and display the saved sprite's
    subPanelGameName.add(gameName);
    master_sub_panel.add(subPanelGameName);

    GridLayout gridLayoutSubPanel1 = new GridLayout(8, 2);
    subPanel1.setLayout(gridLayoutSubPanel1);
    subPanel1.add(spriteName);
    subPanel1.add(spriteNameTextBox);
    subPanel1.add(spriteImageName);
    subPanel1.add(spriteImageComboBox);
    subPanel1.add(spriteX);
    subPanel1.add(spriteXTextBox);
    subPanel1.add(spriteY);
    subPanel1.add(spriteYTextBox);
    subPanel1.add(savedSpriteNames);
    subPanel1.add(savedSpriteComboBox);
    subPanel1.add(new JSeparator(SwingConstants.HORIZONTAL));
    master_sub_panel.add(subPanel1);
    // add sprite sub panel 2, contains the form elements for events
    GridLayout gridLayoutSubPanel2 = new GridLayout(1, 7);
    subPanel2.setLayout(gridLayoutSubPanel2);
    GridLayout gridLayoutKeyPressPanel = new GridLayout(5, 1);
    keyPressPanel.setLayout(gridLayoutKeyPressPanel);
    keyPressPanel.add(keyPressEventForm);
    keyPressPanel.add(moveLeft);
    keyPressPanel.add(moveRight);
    keyPressPanel.add(moveUp);
    keyPressPanel.add(moveDown);
    subPanel2.add(keyPressPanel);
    // subPanel2.add(new JSeparator(SwingConstants.VERTICAL));
    subPanel2.add(selfMove);
    // subPanel2.add(new JSeparator(SwingConstants.VERTICAL));
    GridLayout gridLayoutRepeatPanel = new GridLayout(3, 1);

    GridLayout gridLayoutCollisionEventPanel = new GridLayout(2, 2);
    collisionEventPanel.setLayout(gridLayoutCollisionEventPanel);
    collisionEventPanel.add(collisionEventList);
    collisionEventPanel.add(collisionEventActionList);
    collisionEventPanel.add(collisionEventActionBtn);
    collisionEventPanel.add(collisionEventActionDisplay);
    subPanel2.add(collisionEventPanel);

    master_sub_panel.add(subPanel2);

    // add sprite sub panel 3, contains the reset and save buttons
    subPanel3.setLayout(new FlowLayout());
    subPanel3.add(resetBtn);
    subPanel3.add(saveBtn);
    subPanel3.add(deleteBtn);
    subPanel3.validate();
    // this.panel.add(subPanel3);
    master_sub_panel.add(subPanel3);
    // TO-DO make event generation dynamic

    this.panel.add(master_sub_panel);
  }