int (JList<?> list, IconCompOptionalCompPanel<SimpleColoredComponent> panel, String shortcutText) { SimpleColoredComponent nameComponent = panel.getCenter(); Insets insets = nameComponent.getInsets(); Insets ipad = nameComponent.getIpad(); int freeSpace = list.getWidth() - (list.getInsets().right + list.getInsets().left) - panel.calculateNonResizeableWidth() - (insets.right + insets.left) - (ipad.right + ipad.left); if (StringUtil.isNotEmpty(shortcutText)) { FontMetrics fm = nameComponent.getFontMetrics(nameComponent.getFont().deriveFont(Font.BOLD)); freeSpace -= fm.stringWidth(" " + shortcutText); } return freeSpace; }