Program: 159682
Project: 159682
Buggy source:
private void init(){
  this.cardSelector.setVisible(true);
  this.jPanel1.setVisible(true);
  for (  ICardGrid component : this.cardSelector.getCardGridComponents()) {
    component.clearCardEventListeners();
    component.addCardEventListener(new Listener<Event>(){
      @Override public void event(      Event event){
        if (event.getEventName().equals("String_Node_Str")) {
          SimpleCardView cardView=(SimpleCardView)event.getSource();
          CardInfo cardInfo=CardRepository.instance.findCard(cardView.getExpansionSetCode(),cardView.getCardNumber());
          Card card=null;
          if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
            Iterator sideboard=deck.getSideboard().iterator();
            while (sideboard.hasNext()) {
              card=(Card)sideboard.next();
              if (card.getId().equals(cardView.getId())) {
                break;
              }
            }
          }
 else {
            card=cardInfo != null ? cardInfo.getMockCard() : null;
          }
          if (card != null) {
            deck.getCards().add(card);
            if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
              deck.getSideboard().remove(card);
              cardSelector.removeCard(card.getId());
              cardSelector.setCardCount(deck.getSideboard().size());
              cardSelector.refresh();
            }
            if (cardInfoPane instanceof CardInfoPane) {
              ((CardInfoPane)cardInfoPane).setCard(new CardView(card),null);
            }
            hidePopup();
          }
        }
 else         if (event.getEventName().equals("String_Node_Str") && mode == DeckEditorMode.Constructed) {
          SimpleCardView cardView=(SimpleCardView)event.getSource();
          CardInfo cardInfo=CardRepository.instance.findCard(cardView.getExpansionSetCode(),cardView.getCardNumber());
          Card card=cardInfo != null ? cardInfo.getMockCard() : null;
          if (card != null) {
            deck.getSideboard().add(CardImpl.createCard(card.getClass()));
          }
          if (cardInfoPane instanceof CardInfoPane) {
            ((CardInfoPane)cardInfoPane).setCard(new CardView(card),null);
          }
          hidePopup();
        }
 else         if (event.getEventName().equals("String_Node_Str")) {
          DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick();
        }
 else         if (event.getEventName().equals("String_Node_Str")) {
          DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick();
        }
        refreshDeck();
      }
    }
);
  }
  this.deckArea.clearDeckEventListeners();
  this.deckArea.addDeckEventListener(new Listener<Event>(){
    @Override public void event(    Event event){
      if (event.getEventName().equals("String_Node_Str")) {
        SimpleCardView cardView=(SimpleCardView)event.getSource();
        for (        Card card : deck.getCards()) {
          if (card.getId().equals(cardView.getId())) {
            deck.getCards().remove(card);
            if (mode == DeckEditorMode.Limited || mode == DeckEditorMode.Sideboard) {
              deck.getSideboard().add(card);
              cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()),getBigCard());
            }
            break;
          }
        }
        hidePopup();
        refreshDeck();
      }
 else       if (event.getEventName().equals("String_Node_Str") && mode == DeckEditorMode.Constructed) {
        SimpleCardView cardView=(SimpleCardView)event.getSource();
        for (        Card card : deck.getCards()) {
          if (card.getId().equals(cardView.getId())) {
            deck.getCards().remove(card);
            deck.getSideboard().add(card);
            break;
          }
        }
        hidePopup();
        refreshDeck();
      }
    }
  }
);
  this.deckArea.addSideboardEventListener(new Listener<Event>(){
    @Override public void event(    Event event){
      if (event.getEventName().equals("String_Node_Str")) {
        SimpleCardView cardView=(SimpleCardView)event.getSource();
        for (        Card card : deck.getSideboard()) {
          if (card.getId().equals(cardView.getId())) {
            deck.getSideboard().remove(card);
            deck.getCards().add(card);
            break;
          }
        }
        hidePopup();
        refreshDeck();
      }
    }
  }
);
  refreshDeck();
  this.setVisible(true);
  this.repaint();
}

Fixed version (ground truth):
private void init(){
  this.cardSelector.setVisible(true);
  this.jPanel1.setVisible(true);
  for (  ICardGrid component : this.cardSelector.getCardGridComponents()) {
    component.clearCardEventListeners();
    component.addCardEventListener(new Listener<Event>(){
      @Override public void event(      Event event){
        if (event.getEventName().equals("String_Node_Str")) {
          SimpleCardView cardView=(SimpleCardView)event.getSource();
          CardInfo cardInfo=CardRepository.instance.findCard(cardView.getExpansionSetCode(),cardView.getCardNumber());
          Card card=null;
          if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
            Iterator sideboard=deck.getSideboard().iterator();
            while (sideboard.hasNext()) {
              card=(Card)sideboard.next();
              if (card.getId().equals(cardView.getId())) {
                break;
              }
            }
          }
 else {
            card=cardInfo != null ? cardInfo.getMockCard() : null;
          }
          if (card != null) {
            deck.getCards().add(card);
            if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
              deck.getSideboard().remove(card);
              cardSelector.removeCard(card.getId());
              cardSelector.setCardCount(deck.getSideboard().size());
              cardSelector.refresh();
            }
            if (cardInfoPane instanceof CardInfoPane) {
              ((CardInfoPane)cardInfoPane).setCard(new CardView(card),null);
            }
            hidePopup();
          }
        }
 else         if (event.getEventName().equals("String_Node_Str") && mode == DeckEditorMode.Constructed) {
          SimpleCardView cardView=(SimpleCardView)event.getSource();
          CardInfo cardInfo=CardRepository.instance.findCard(cardView.getExpansionSetCode(),cardView.getCardNumber());
          Card card=cardInfo != null ? cardInfo.getMockCard() : null;
          if (card != null) {
            deck.getSideboard().add(card);
          }
          if (cardInfoPane instanceof CardInfoPane) {
            ((CardInfoPane)cardInfoPane).setCard(new CardView(card),null);
          }
          hidePopup();
        }
 else         if (event.getEventName().equals("String_Node_Str")) {
          DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick();
        }
 else         if (event.getEventName().equals("String_Node_Str")) {
          DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick();
        }
        refreshDeck();
      }
    }
);
  }
  this.deckArea.clearDeckEventListeners();
  this.deckArea.addDeckEventListener(new Listener<Event>(){
    @Override public void event(    Event event){
      if (event.getEventName().equals("String_Node_Str")) {
        SimpleCardView cardView=(SimpleCardView)event.getSource();
        for (        Card card : deck.getCards()) {
          if (card.getId().equals(cardView.getId())) {
            deck.getCards().remove(card);
            if (mode == DeckEditorMode.Limited || mode == DeckEditorMode.Sideboard) {
              deck.getSideboard().add(card);
              cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()),getBigCard());
            }
            break;
          }
        }
        hidePopup();
        refreshDeck();
      }
 else       if (event.getEventName().equals("String_Node_Str") && mode == DeckEditorMode.Constructed) {
        SimpleCardView cardView=(SimpleCardView)event.getSource();
        for (        Card card : deck.getCards()) {
          if (card.getId().equals(cardView.getId())) {
            deck.getCards().remove(card);
            deck.getSideboard().add(card);
            break;
          }
        }
        hidePopup();
        refreshDeck();
      }
    }
  }
);
  this.deckArea.addSideboardEventListener(new Listener<Event>(){
    @Override public void event(    Event event){
      if (event.getEventName().equals("String_Node_Str")) {
        SimpleCardView cardView=(SimpleCardView)event.getSource();
        for (        Card card : deck.getSideboard()) {
          if (card.getId().equals(cardView.getId())) {
            deck.getSideboard().remove(card);
            deck.getCards().add(card);
            break;
          }
        }
        hidePopup();
        refreshDeck();
      }
    }
  }
);
  refreshDeck();
  this.setVisible(true);
  this.repaint();
}