public Collection<RoboticonFile> getRoboticonFiles() { Collection<RoboticonFile> fileList = new ArrayList<RoboticonFile>(0); if (this.exists() && this.isDirectory()) { fileList = RoboticonFile.toRoboticonFileList( this.listFiles(XML_FILENAME_FILTER), this.roboticonType); } return fileList; }
public Component getListCellRendererComponent( final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final RoboticonFile roboticonFile = (RoboticonFile) value; JLabel label = new JLabel(); label.setOpaque(true); label.setBorder(BorderFactory.createEmptyBorder()); label.setHorizontalAlignment(JLabel.LEFT); label.setVerticalTextPosition(JLabel.CENTER); label.setFont(FONT); label.setEnabled(list.isEnabled()); label.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); label.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); // BOLD text if sequence if (roboticonFile.roboticonType.equals(RoboticonType.SEQUENCE)) { label.setFont(BOLD_FONT); } String fileName = roboticonFile == null ? "unknown" : roboticonFile.getName(); if (fileName.lastIndexOf('.') != -1) { fileName = fileName.substring(0, fileName.lastIndexOf('.')); } label.setText(fileName); String toolTip = null; if (roboticonFile != null) { toolTip = roboticonFile.senderId; if (toolTip.length() == 0) { toolTip = roboticonFile.getAbsolutePath(); } } label.setToolTipText(toolTip); return label; }