JComponent () { createLabel(); JPanel panel = new JPanel(new BorderLayout()) { private final AccessibleContext myAccessibleContext = myTextLabel.getAccessibleContext(); @Override public AccessibleContext getAccessibleContext() { if (myAccessibleContext == null) { return super.getAccessibleContext(); } return myAccessibleContext; } @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); if (ExperimentalUI.isNewUI()) { size.height = JBUI.CurrentTheme.List.rowHeight(); } return size; } }; panel.add(myTextLabel, BorderLayout.WEST); myValueLabel = new JLabel(); myValueLabel.setEnabled(false); JBEmptyBorder valueBorder = ExperimentalUI.isNewUI() ? JBUI.Borders.empty() : JBUI.Borders.empty(0, 8, 1, 0); myValueLabel.setBorder(valueBorder); myValueLabel.setForeground(UIManager.getColor("MenuItem.acceleratorForeground")); panel.add(myValueLabel, BorderLayout.CENTER); myShortcutLabel = new JLabel(); JBEmptyBorder shortcutBorder = ExperimentalUI.isNewUI() ? JBUI.Borders.empty() : JBUI.Borders.empty(0,0,1,3); myShortcutLabel.setBorder(shortcutBorder); myShortcutLabel.setForeground(UIManager.getColor("MenuItem.acceleratorForeground")); panel.add(myShortcutLabel, BorderLayout.EAST); myMnemonicLabel = new JLabel(); myMnemonicLabel.setFont(JBUI.CurrentTheme.ActionsList.applyStylesForNumberMnemonic(myMnemonicLabel.getFont())); if (!ExperimentalUI.isNewUI()) { Insets insets = JBUI.CurrentTheme.ActionsList.numberMnemonicInsets(); myMnemonicLabel.setBorder(new JBEmptyBorder(insets)); //noinspection HardCodedStringLiteral Dimension preferredSize = new JLabel("W").getPreferredSize(); JBInsets.addTo(preferredSize, insets); myMnemonicLabel.setPreferredSize(preferredSize); } else { myMnemonicLabel.setBorder(new JBEmptyBorder(JBUI.CurrentTheme.ActionsList.mnemonicInsets())); myMnemonicLabel.setHorizontalAlignment(SwingConstants.RIGHT); //noinspection HardCodedStringLiteral myMnemonicLabel.setText("W"); Dimension preferredSize = myMnemonicLabel.getPreferredSize(); myMnemonicLabel.setText(null); JBInsets.addTo(preferredSize, JBUI.insetsLeft(4)); myMnemonicLabel.setPreferredSize(preferredSize); myMnemonicLabel.setMinimumSize(JBUI.size(12, myMnemonicLabel.getMinimumSize().height)); } myMnemonicLabel.setVisible(false); myIconBar = createIconBar(); return layoutComponent(panel); }