JComponent () { final ComboBox<Repository> repoSelector = new ComboBox<>(myCompareInfo.getRepositories().toArray(new Repository[0])); repoSelector.setRenderer(new RepositoryComboboxListCellRenderer()); repoSelector.setSelectedItem(myInitialRepo); repoSelector.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Repository selectedRepo = (Repository)repoSelector.getSelectedItem(); myHeadToBranchListPanel.setCommits(getHeadToBranchCommits(selectedRepo)); myBranchToHeadListPanel.setCommits(getBranchToHeadCommits(selectedRepo)); } }); JPanel repoSelectorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); JBLabel label = new JBLabel(DvcsBundle.message("label.repository") + " "); label.setLabelFor(repoSelectorPanel); label.setDisplayedMnemonic(KeyEvent.VK_R); repoSelectorPanel.add(label); repoSelectorPanel.add(repoSelector); if (myCompareInfo.getRepositories().size() < 2) { repoSelectorPanel.setVisible(false); } return repoSelectorPanel; }