JComponent (@NotNull ActionToolbar toolbar) { JComponent toolbarComponent = toolbar.getComponent(); toolbarComponent.setBorder(JBUI.Borders.empty()); return new NonOpaquePanel(toolbarComponent) { @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); if (size.height > 0) { size.height = JBUI.scale(JBUI.unscale(JBRunnerTabs.getTabLabelPreferredHeight()) - 1); // without bottom border } return size; } }; }