final CatalogTexture texture = (CatalogTexture)value;
value = texture.getName();
value = texture.getCategory().getName() + " - " + value;
Component component = super.getListCellRendererComponent(
list, value, index, isSelected, cellHasFocus);
setIcon(new Icon() {
public int getIconWidth() {
return 16;
}
public int getIconHeight() {
return 16;
}
public void paintIcon(Component c, Graphics g, int x, int y) {
Icon icon = IconManager.getInstance().getIcon(
texture.getImage(), getIconHeight(), list);
if (icon.getIconWidth() != icon.getIconHeight()) {
Graphics2D g2D = (Graphics2D)g;
AffineTransform previousTransform = g2D.getTransform();
g2D.translate(x, y);
g2D.scale((float)icon.getIconHeight() / icon.getIconWidth(), 1);
icon.paintIcon(c, g2D, 0, 0);
g2D.setTransform(previousTransform);
} else {
icon.paintIcon(c, g, x, y);
}
}
});
setFont(texture.isModifiable() ? this.modifiablePieceFont : this.defaultFont);
return component;