void (final AbstractListBuilder builder) { myBuilder = builder; removeAll(); myTitlePanel = new JPanel(new BorderLayout()); myTitlePanel.setBackground(UIUtil.getControlColor()); myTitlePanel.setOpaque(true); myParentTitle = new MyTitleLabel(myTitlePanel); myParentTitle.setText(" "); myParentTitle.setFont(StartupUiUtil.getLabelFont().deriveFont(Font.BOLD)); myParentTitle.setForeground(JBColor.foreground()); myParentTitle.setUI(new RightAlignedLabelUI()); final JPanel panel1 = new JPanel(new BorderLayout()); panel1.setOpaque(false); panel1.add(Box.createHorizontalStrut(10), BorderLayout.WEST); panel1.add(myParentTitle, BorderLayout.CENTER); myTitlePanel.add(panel1, BorderLayout.CENTER); add(myTitlePanel, BorderLayout.NORTH); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myList); scrollPane.setBorder(null); scrollPane.getVerticalScrollBar().setFocusable(false); // otherwise the scrollbar steals focus and panel switching with tab is broken scrollPane.getHorizontalScrollBar().setFocusable(false); add(scrollPane, BorderLayout.CENTER); myBuilder.setParentTitle(myParentTitle); // TODO[vova,anton] it seems that the code below performs double focus request. Is it OK? myTitlePanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myList, true)); } @Override public void mousePressed(final MouseEvent e) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myList, true)); } }); }