/** * Returns the <tt>Component</tt> that displays the icons & names based on the * <tt>IconAndNameHolder</tt> object. */ public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { IconAndNameHolder in = (IconAndNameHolder) value; Icon icon = null; String name = null; if (in != null) { icon = in.getIcon(); name = in.getName(); if (name != null) { String strValue = name.toString(); strValue = strValue.replace("<html>", "<html><div width=\"1000000px\">"); strValue = strValue.replace("</html>", "</div></html>"); name = strValue; } } setIcon(icon); Component comp = super.getTableCellRendererComponent(table, name, isSelected, hasFocus, row, column); ThemeMediator.fixLabelFont((JLabel) comp); return comp; }
@Override public Component getListCellRendererComponent( JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); LibraryPlaylistsListCell cell = (LibraryPlaylistsListCell) value; setText(cell.getText()); setToolTipText(cell.getDescription()); setPreferredSize( new Dimension(getSize().width, TableSettings.DEFAULT_TABLE_ROW_HEIGHT.getValue())); Icon icon = cell.getIcon(); if (icon != null) { setIcon(icon); } this.setFont(list.getFont()); ThemeMediator.fixLabelFont(this); return this; }