JComponent () { Box res = Box.createHorizontalBox(); res.add(myIconLabel); if (!ExperimentalUI.isNewUI()) { res.setBorder(JBUI.Borders.emptyRight(JBUI.CurrentTheme.ActionsList.elementIconGap())); res.add(myMnemonicLabel); } else { //need to wrap to align mnemonics to the right JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(myMnemonicLabel); res.add(wrapper); } return res; }