Component (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); String path = getPath(value); if (path != null) { int max = index == -1 ? myComboBox.getWidth() - myContextFile.getButton().getWidth() : myComboBox.getWidth() * 3; path = trimPath(path, myComboBox, "/", max); setText(path); } return rendererComponent; }