JComponent () { FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(myFileName); myTitleLabel.setText(fileType == FileTypes.UNKNOWN ? FileTypesBundle.message("filetype.chooser.prompt", myFileName) : FileTypesBundle.message("filetype.chooser.change.prompt", myFileName, fileType.getName())); myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myList.setCellRenderer(new FileTypeRenderer() { @Override public void customize(@NotNull JList<? extends FileType> list, FileType value, int index, boolean selected, boolean hasFocus) { super.customize(list, value, index, selected, hasFocus); if (!myOpenInIdea.isSelected()) { setForeground(selected ? NamedColorUtil.getListSelectionForeground(hasFocus) : UIUtil.getComboBoxDisabledForeground()); setBackground(selected ? UIUtil.getListSelectionBackground(hasFocus) : UIUtil.getComboBoxDisabledBackground()); } } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(@NotNull MouseEvent e) { doOKAction(); return true; } }.installOn(myList); myList.getSelectionModel().addListSelectionListener(__ -> updateButtonsState() ); ScrollingUtil.selectItem(myList, FileTypes.PLAIN_TEXT); return myPanel; }