@Nullable @Override protected JComponent createCenterPanel() { myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myList.setCellRenderer(new FileTypeRenderer()); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { doOKAction(); return true; } }.installOn(myList); CCLanguageManager manager = CCUtils.getStudyLanguageManager(myCourse); if (manager != null) { String extension = manager.getDefaultTaskFileExtension(); ScrollingUtil.selectItem(myList, FileTypeManager.getInstance().getFileTypeByExtension(extension != null ? extension : "txt")); } return myPanel; }
@Override protected JComponent createCenterPanel() { myTitleLabel.setText(FileTypesBundle.message("filetype.chooser.prompt", myFileName)); myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myList.setCellRenderer(new FileTypeRenderer()); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { doOKAction(); return true; } }.installOn(myList); myList.getSelectionModel().addListSelectionListener(e -> updateButtonsState()); ScrollingUtil.selectItem(myList, PlainTextFileType.INSTANCE); return myPanel; }