in src/main/java/org/jetbrains/plugins/spotbugs/gui/tree/view/QuickSearch.java [862:913]
private void initGui() {
_label = new JLabel("Recent Searches");
_label.setPreferredSize(new Dimension(getPreferredSize().width, _label.getPreferredSize().height + 5));
_label.setForeground(_foregroundColor);
_label.setBackground(_backgroundColor);
_label.setOpaque(true);
_label.setHorizontalAlignment(SwingConstants.CENTER);
_label.setVerticalAlignment(SwingConstants.CENTER);
_listModel = new DefaultListModel();
_list = new JBList(_listModel);
_list.setBorder(BorderFactory.createEmptyBorder(8, 5, 8, 5));
_list.setAutoscrolls(true);
_list.setFocusable(false);
_list.setRequestFocusEnabled(false);
updateListData(_recentSearches);
_list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
_list.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(final MouseEvent e) {
locationToListIndex(e);
}
});
_list.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(final ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
if (_list.getSelectedIndex() > -1) {
_popup.getSearchField().setText((String) _list.getSelectedValue());
}
}
});
//updatePopupBounds();
final JScrollPane scrollPane = ScrollPaneFacade.createScrollPane();
scrollPane.getViewport().setView(_list);
scrollPane.setBorder(null);
scrollPane.setForeground(_foregroundColor);
setLayout(new BorderLayout());
setBackground(_backgroundColor);
setOpaque(true);
setBorder(BorderFactory.createLineBorder(JBColor.GRAY, 1));
add(_label, BorderLayout.NORTH);
add(scrollPane, BorderLayout.CENTER);
}