JComponent () { JPanel contributorsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); contributorsPanel.setOpaque(false); for (SETab tab : myTabs) { SETabLabel tabLabel = new SETabLabel(tab); @NlsSafe String shortcut = myShortcutSupplier.apply(tab.getID()); if (shortcut != null) { tabLabel.setToolTipText(shortcut); } tabLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { switchToTab(tab); SearchEverywhereUsageTriggerCollector.TAB_SWITCHED.log(myProject, SearchEverywhereUsageTriggerCollector.CONTRIBUTOR_ID_FIELD.with( tab.getReportableID()), EventFields.InputEventByMouseEvent.with(e)); } }); contributorsPanel.add(tabLabel); } myToolbar.setTargetComponent(contributorsPanel); JPanel result = new JPanel(new BorderLayout()); result.add(contributorsPanel, BorderLayout.WEST); result.add(myToolbar.getComponent(), BorderLayout.EAST); return result; }