/* This is the only method defined by ListCellRenderer. We just * reconfigure the Jlabel each time we're called. */ public Component getListCellRendererComponent( JList list, Object value, // value to display int index, // cell index boolean iss, // is the cell selected boolean chf) // the list and the cell have the focus { /* The DefaultListCellRenderer class will take care of * the JLabels text property, it's foreground and background * colors, and so on. */ super.getListCellRendererComponent(list, value, index, iss, chf); if (afks.contains(value.toString())) { setIcon(afk); } else if (admins.contains(value.toString())) { setIcon(admin); } else if (ignores.contains(value.toString())) { setIcon(ignored); } else { setIcon(normal); } if (username.equals(getText())) { setForeground(myColors[1]); } else { setForeground(myColors[2]); } return this; }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setText(getFileChooser().getName((File) value)); return this; }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); IconListEntry icon = (IconListEntry) value; setIcon(icon.icon); return this; }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (String.valueOf(value).equals("Original")) { setText(AppPrefs.getInstance().getMessages().getString("lblViewNameOriginal")); } // TODO, also remember about adding views, shouldn't allow localized original value return this; }
@Override public Component getListCellRendererComponent( JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); String extension = FilenameUtils.getExtension(value.toString()); if (extension != null) { setIcon(IconManager.instance().getIconForExtension(extension)); } return this; }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value != null && value instanceof FileFilter) { setText(((FileFilter) value).getDescription()); } return this; }
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); ParentDirectoryRenderer.this.setBorder(new EmptyBorder(1, index * 5 + 1, 1, 1)); if (value instanceof LoadingPlaceholder) { ParentDirectoryRenderer.this.setFont(plainFont); setIcon(showIcons ? FileCellRenderer.loadingIcon : null); setText(jEdit.getProperty("vfs.browser.tree.loading")); } else if (value instanceof VFSFile) { VFSFile dirEntry = (VFSFile) value; ParentDirectoryRenderer.this.setFont(boldFont); setIcon(showIcons ? FileCellRenderer.getIconForFile(dirEntry, true) : null); setText(dirEntry.getName()); } else if (value == null) setText("VFS does not follow VFS API"); return this; }