void () { AbstractListModel<KtNamedDeclaration> listModel = new AbstractListModel<>() { @Override public int getSize() { return variables.length; } @Override public KtNamedDeclaration getElementAt(int index) { return variables[index]; } }; targetVariableList = new JBList<>(listModel); DefaultListCellRenderer listCellRenderer = new DefaultListCellRenderer() { private final DescriptorRenderer renderer = IdeDescriptorRenderers.SOURCE_CODE_TYPES_WITH_SHORT_NAMES; @Override public Component getListCellRendererComponent( JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus ) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value instanceof KtNamedDeclaration variable) { setIcon(KotlinIconProvider.Companion.getBaseIcon(variable)); setText(variable.getName()); KotlinType type = MoveKotlinMethodProcessorKt.type(variable); if (type != null) { @NlsSafe String renderType = renderer.renderType(type); setText(getText() + ": " + renderType); } } return this; } }; targetVariableList.setCellRenderer(listCellRenderer); targetVariableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); int defaultVariableIndex = -1; for (int i = 0; i < variables.length; i++) { if (variableToClassMap.get(variables[i]) == targetContainer) { defaultVariableIndex = i; } } targetVariableList.setSelectedIndex(defaultVariableIndex != -1 ? defaultVariableIndex : 0); targetVariableList.getSelectionModel().addListSelectionListener(e -> enableTextFields()); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(targetVariableList); targetVariableListPanel.add(scrollPane); }