Program: 3974
Project: 3974
Buggy source:
@Inject public LibrarySharePanel(List<SharingTarget> allFriends){
  GuiUtils.assignResources(this);
  this.allFriends=allFriends;
  setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
  setOpaque(false);
  setBorder(new LineBorder(Color.BLACK));
  mainPanel=new JXPanel(new GridBagLayout());
  mainPanel.setOpaque(false);
  inputField=new JTextField(12);
  inputField.setBorder(null);
  shareLabel=new JLabel(I18n.tr("String_Node_Str"));
  shareFriendList=GlazedListsFactory.threadSafeList(GlazedListsFactory.sortedList(new BasicEventList<SharingTarget>(),new SharingTargetComparator()));
  shareTable=new ToolTipTable(new EventTableModel<SharingTarget>(shareFriendList,new LibraryShareTableFormat(1)));
  shareTable.setTableHeader(null);
  final ShareRendererEditor removeEditor=new ShareRendererEditor(removeIcon,removeIconRollover,removeIconPressed);
  removeEditor.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      unshareFriend(removeEditor.getFriend());
      removeEditor.cancelCellEditing();
      inputField.requestFocusInWindow();
    }
  }
);
  shareTable.setHighlighters(new ColorHighlighter());
  shareTable.setRowHeight(removeEditor.getPreferredSize().height);
  shareTable.getColumnModel().getColumn(1).setCellEditor(removeEditor);
  shareTable.getColumnModel().getColumn(1).setPreferredWidth(removeEditor.getPreferredSize().width);
  shareTable.getColumnModel().getColumn(1).setMaxWidth(removeEditor.getPreferredSize().width);
  shareTable.getColumnModel().getColumn(1).setCellRenderer(new ShareRendererEditor(removeIcon,removeIconRollover,removeIconPressed));
  shareTable.setShowGrid(false);
  shareTable.setOpaque(false);
  shareTable.setColumnSelectionAllowed(false);
  shareTable.setRowSelectionAllowed(false);
  TextFilterator<SharingTarget> textFilter=new TextFilterator<SharingTarget>(){
    @Override public void getFilterStrings(    List<String> baseList,    SharingTarget element){
      baseList.add(element.getFriend().getName());
      baseList.add(element.getFriend().getId());
    }
  }
;
  noShareFriendList=GlazedLists.threadSafeList(GlazedListsFactory.sortedList(new BasicEventList<SharingTarget>(),new SharingTargetComparator()));
  final TextMatcherEditor<SharingTarget> textMatcher=new TextMatcherEditor<SharingTarget>(textFilter);
  noShareFilterList=GlazedListsFactory.filterList(noShareFriendList,textMatcher);
  friendCombo=new JComboBox(new EventComboBoxModel<SharingTarget>(noShareFilterList));
  ShareComboBoxUI comboUI=new ShareComboBoxUI();
  friendCombo.setUI(comboUI);
  friendCombo.setEditor(new ShareComboBoxEditor());
  friendCombo.setEditable(true);
  comboPopup=comboUI.getPopup();
  friendCombo.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (friendCombo.isPopupVisible() && (e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
        shareSelectedFriend();
      }
    }
  }
);
  inputField.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (noShareFilterList.size() == 0 || !friendCombo.isPopupVisible() && ("String_Node_Str".equals(inputField.getText()) || inputField.getText() == null)) {
        dialog.setVisible(false);
      }
 else       if (friendCombo.getSelectedIndex() >= 0) {
        shareSelectedFriend();
        friendCombo.hidePopup();
      }
    }
  }
);
  inputField.getDocument().addDocumentListener(new DocumentListener(){
    @Override public void changedUpdate(    DocumentEvent e){
      update();
    }
    @Override public void insertUpdate(    DocumentEvent e){
      update();
    }
    @Override public void removeUpdate(    DocumentEvent e){
      update();
    }
    private void update(){
      textMatcher.setFilterText(inputField.getText().split("String_Node_Str"));
      if (noShareFilterList.size() > 0) {
        friendCombo.setSelectedIndex(0);
        if (isVisible()) {
          friendCombo.showPopup();
        }
      }
    }
  }
);
  shareScroll=new JScrollPane(shareTable);
  shareScroll.setBorder(new EmptyBorder(0,shareTableIndent,0,0));
  shareScroll.setOpaque(false);
  friendLabel=new JLabel(I18n.tr("String_Node_Str"));
  shareFriendList.addListEventListener(new ListEventListener<SharingTarget>(){
    @Override public void listChanged(    ListEvent<SharingTarget> listChanges){
      adjustFriendLabelVisibility();
    }
  }
);
  Dimension labelSize=friendLabel.getPreferredSize().width > shareLabel.getPreferredSize().width ? friendLabel.getPreferredSize() : shareLabel.getPreferredSize();
  friendLabel.setPreferredSize(labelSize);
  shareLabel.setPreferredSize(labelSize);
  bottomLabel=new MultiLineLabel("String_Node_Str",WIDTH);
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.weightx=1.0;
  gbc.weighty=0;
  gbc.fill=GridBagConstraints.BOTH;
  gbc.insets=new Insets(0,HGAP,0,HGAP);
  gbc.gridy=0;
  gbc.weighty=0;
  mainPanel.add(shareLabel,gbc);
  gbc.gridy++;
  gbc.weighty=1.0;
  mainPanel.add(shareScroll,gbc);
  gbc.gridy++;
  mainPanel.add(friendLabel,gbc);
  gbc.gridy++;
  gbc.weighty=1.0;
  mainPanel.add(friendCombo,gbc);
  gbc.gridy++;
  mainPanel.add(bottomLabel,gbc);
  add(mainPanel);
  EventAnnotationProcessor.subscribe(this);
  setKeyStrokes(this);
  setKeyStrokes(mainPanel);
  setKeyStrokes(inputField);
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      if (dialog.isVisible()) {
        dialog.pack();
      }
    }
    @Override public void componentShown(    ComponentEvent e){
      inputField.requestFocusInWindow();
    }
  }
);
  eventListener=new AWTEventListener(){
    @Override public void eventDispatched(    AWTEvent event){
      if (dialog.isVisible()) {
        if ((event.getID() == MouseEvent.MOUSE_PRESSED)) {
          MouseEvent e=(MouseEvent)event;
          if (LibrarySharePanel.this != e.getComponent() && !contains(e.getComponent())) {
            dialog.setVisible(false);
          }
        }
 else         if (event.getID() == KeyEvent.KEY_TYPED) {
          KeyEvent e=(KeyEvent)event;
          if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
            dialog.setVisible(false);
          }
        }
      }
    }
  }
;
}

Fixed version (ground truth):
@Inject public LibrarySharePanel(List<SharingTarget> allFriends){
  GuiUtils.assignResources(this);
  this.allFriends=allFriends;
  setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
  setOpaque(false);
  setBorder(new LineBorder(Color.BLACK));
  mainPanel=new JXPanel(new GridBagLayout());
  mainPanel.setOpaque(false);
  inputField=new JTextField(12);
  inputField.setBorder(null);
  shareLabel=new JLabel(I18n.tr("String_Node_Str"));
  shareFriendList=GlazedListsFactory.threadSafeList(GlazedListsFactory.sortedList(new BasicEventList<SharingTarget>(),new SharingTargetComparator()));
  shareTable=new ToolTipTable(new EventTableModel<SharingTarget>(shareFriendList,new LibraryShareTableFormat(1)));
  shareTable.setTableHeader(null);
  final ShareRendererEditor removeEditor=new ShareRendererEditor(removeIcon,removeIconRollover,removeIconPressed);
  removeEditor.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      unshareFriend(removeEditor.getFriend());
      removeEditor.cancelCellEditing();
      inputField.requestFocusInWindow();
    }
  }
);
  shareTable.setHighlighters(new ColorHighlighter());
  shareTable.setRowHeight(removeEditor.getPreferredSize().height);
  shareTable.getColumnModel().getColumn(1).setCellEditor(removeEditor);
  shareTable.getColumnModel().getColumn(1).setPreferredWidth(removeEditor.getPreferredSize().width);
  shareTable.getColumnModel().getColumn(1).setMaxWidth(removeEditor.getPreferredSize().width);
  shareTable.getColumnModel().getColumn(1).setCellRenderer(new ShareRendererEditor(removeIcon,removeIconRollover,removeIconPressed));
  shareTable.setShowGrid(false);
  shareTable.setOpaque(false);
  shareTable.setColumnSelectionAllowed(false);
  shareTable.setRowSelectionAllowed(false);
  TextFilterator<SharingTarget> textFilter=new TextFilterator<SharingTarget>(){
    @Override public void getFilterStrings(    List<String> baseList,    SharingTarget element){
      baseList.add(element.getFriend().getName());
      baseList.add(element.getFriend().getId());
    }
  }
;
  noShareFriendList=GlazedLists.threadSafeList(GlazedListsFactory.sortedList(new BasicEventList<SharingTarget>(),new SharingTargetComparator()));
  final TextMatcherEditor<SharingTarget> textMatcher=new TextMatcherEditor<SharingTarget>(textFilter);
  noShareFilterList=GlazedListsFactory.filterList(noShareFriendList,textMatcher);
  friendCombo=new JComboBox(new EventComboBoxModel<SharingTarget>(noShareFilterList));
  ShareComboBoxUI comboUI=new ShareComboBoxUI();
  friendCombo.setUI(comboUI);
  friendCombo.setEditor(new ShareComboBoxEditor());
  friendCombo.setEditable(true);
  comboPopup=comboUI.getPopup();
  MouseListener shareListener=new MouseAdapter(){
    private int pressedRow;
    @Override public void mousePressed(    MouseEvent e){
      pressedRow=comboPopup.getList().locationToIndex(e.getPoint());
    }
    @Override public void mouseReleased(    MouseEvent e){
      if (pressedRow == comboPopup.getList().locationToIndex(e.getPoint())) {
        shareSelectedFriend();
      }
    }
  }
;
  comboPopup.getList().addMouseListener(shareListener);
  inputField.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      if (noShareFilterList.size() == 0 || !friendCombo.isPopupVisible() && ("String_Node_Str".equals(inputField.getText()) || inputField.getText() == null)) {
        dialog.setVisible(false);
      }
 else       if (friendCombo.getSelectedIndex() >= 0) {
        shareSelectedFriend();
        friendCombo.hidePopup();
      }
    }
  }
);
  inputField.getDocument().addDocumentListener(new DocumentListener(){
    @Override public void changedUpdate(    DocumentEvent e){
      update();
    }
    @Override public void insertUpdate(    DocumentEvent e){
      update();
    }
    @Override public void removeUpdate(    DocumentEvent e){
      update();
    }
    private void update(){
      textMatcher.setFilterText(inputField.getText().split("String_Node_Str"));
      if (noShareFilterList.size() > 0) {
        friendCombo.setSelectedIndex(0);
        if (isVisible()) {
          friendCombo.showPopup();
        }
      }
    }
  }
);
  shareScroll=new JScrollPane(shareTable);
  shareScroll.setBorder(new EmptyBorder(0,shareTableIndent,0,0));
  shareScroll.setOpaque(false);
  friendLabel=new JLabel(I18n.tr("String_Node_Str"));
  shareFriendList.addListEventListener(new ListEventListener<SharingTarget>(){
    @Override public void listChanged(    ListEvent<SharingTarget> listChanges){
      adjustFriendLabelVisibility();
    }
  }
);
  Dimension labelSize=friendLabel.getPreferredSize().width > shareLabel.getPreferredSize().width ? friendLabel.getPreferredSize() : shareLabel.getPreferredSize();
  friendLabel.setPreferredSize(labelSize);
  shareLabel.setPreferredSize(labelSize);
  bottomLabel=new MultiLineLabel("String_Node_Str",WIDTH);
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.weightx=1.0;
  gbc.weighty=0;
  gbc.fill=GridBagConstraints.BOTH;
  gbc.insets=new Insets(0,HGAP,0,HGAP);
  gbc.gridy=0;
  gbc.weighty=0;
  mainPanel.add(shareLabel,gbc);
  gbc.gridy++;
  gbc.weighty=1.0;
  mainPanel.add(shareScroll,gbc);
  gbc.gridy++;
  mainPanel.add(friendLabel,gbc);
  gbc.gridy++;
  gbc.weighty=1.0;
  mainPanel.add(friendCombo,gbc);
  gbc.gridy++;
  mainPanel.add(bottomLabel,gbc);
  add(mainPanel);
  EventAnnotationProcessor.subscribe(this);
  setKeyStrokes(this);
  setKeyStrokes(mainPanel);
  setKeyStrokes(inputField);
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      if (dialog.isVisible()) {
        dialog.pack();
      }
    }
    @Override public void componentShown(    ComponentEvent e){
      inputField.requestFocusInWindow();
    }
  }
);
  eventListener=new AWTEventListener(){
    @Override public void eventDispatched(    AWTEvent event){
      if (dialog.isVisible()) {
        if ((event.getID() == MouseEvent.MOUSE_PRESSED)) {
          MouseEvent e=(MouseEvent)event;
          if (LibrarySharePanel.this != e.getComponent() && !contains(e.getComponent())) {
            dialog.setVisible(false);
          }
        }
 else         if (event.getID() == KeyEvent.KEY_TYPED) {
          KeyEvent e=(KeyEvent)event;
          if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
            dialog.setVisible(false);
          }
        }
      }
    }
  }
;
}