void () { myItems = createItems(); presetItems(); DefaultListModel<JCheckBox> model = new DefaultListModel<>(); CheckBoxList<MyFileTypeItem> checkBoxList = new CheckBoxList<>(model) { @Override protected JComponent adjustRendering(JComponent rootComponent, JCheckBox checkBox, int index, boolean selected, boolean hasFocus) { MyFileTypeItem item = myItems.get(index); Color textColor = getForeground(selected); Color backgroundColor = getBackground(selected); JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 2)) { private final AccessibleContext myContext = checkBox.getAccessibleContext(); @Override public AccessibleContext getAccessibleContext() { return myContext; } }; if (item.isSubType()) { panel.add(Box.createRigidArea(new Dimension(JBUIScale.scale(20),1))); } panel.add(checkBox); if (!item.isSubType() && !item.isGroupItem()) { JLabel infoLabel = new JLabel(item.getExtensionList(), SwingConstants.LEFT); infoLabel.setBorder(JBUI.Borders.emptyLeft(JBUIScale.scale(8))); panel.add(infoLabel); panel.setBackground(backgroundColor); infoLabel.setForeground(selected ? textColor : JBColor.GRAY); infoLabel.setBackground(backgroundColor); panel.getAccessibleContext().setAccessibleDescription(infoLabel.getText()); } panel.setBackground(backgroundColor); return panel; } @Override protected @Nullable Point findPointRelativeToCheckBox(int x, int y, @NotNull JCheckBox checkBox, int index) { return super.findPointRelativeToCheckBoxWithAdjustedRendering(x, y, checkBox, index); } }; model.addAll(myItems); checkBoxList.setCheckBoxListListener(new CheckBoxListListener() { @Override public void checkBoxSelectionChanged(int index, boolean value) { onItemStateChange(myItems.get(index), value); } }); myFileTypesList = checkBoxList; if (!myFileTypesList.isEmpty()) myFileTypesList.setSelectedIndex(0); // noinspection rawtypes,unchecked ListSpeedSearch.installOn(myFileTypesList, o -> ((MyFileTypeItem)o).getText()); }