Component ( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus ) { if (value instanceof VirtualFile file) { setFileName(file.getName()); String toolTipText = IfsUtil.getReferencePath(thumbnailView.getProject(), file); if (!isFileSizeVisible()) { String description = getImageComponent().getDescription(); if (description != null) { toolTipText += " [" + description + "]"; } } setToolTipText(toolTipText); setDirectory(file.isDirectory()); if (file.isDirectory()) { int imagesCount = 0; VirtualFile[] children = file.getChildren(); for (VirtualFile child : children) { if (typeManager.isImage(child)) { imagesCount++; if (imagesCount > 100) { break; } } } setImagesCount(imagesCount); } else { // File rendering setFileSize(file.getLength()); try { ImageComponent imageComponent = getImageComponent(); BufferedImage image = IfsUtil.getImage(file, imageComponent); imageComponent.getDocument().setValue(image); setFormat(IfsUtil.getFormat(file)); } catch (Exception e) { // Ignore ImageComponent imageComponent = getImageComponent(); imageComponent.getDocument().setValue((BufferedImage)null); } } } else { ImageComponent imageComponent = getImageComponent(); imageComponent.getDocument().setValue((BufferedImage)null); setFileName(null); setFileSize(0); setToolTipText(null); } if (isSelected) { setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else { setForeground(list.getForeground()); setBackground(list.getBackground()); } return this; }