ListPopup (@NotNull ListPopup popup) { int nameLen = 0; ListPopupStep step = popup.getListStep(); List values = step.getValues(); for (Object v : values) { //noinspection unchecked nameLen = Math.max(nameLen, step.getTextFor(v).length()); } if (values.size() > MAX_VISIBLE_SIZE) { Dimension size = new JLabel(StringUtil.repeatSymbol('a', nameLen), EmptyIcon.ICON_16, SwingConstants.LEFT).getPreferredSize(); //NON-NLS size.width += 20; size.height *= MAX_VISIBLE_SIZE; popup.setSize(size); } return popup; }