setForeground(list.getForeground());
}
if (value == null) return this;
PlayerPresence presence = thePresenceManager.getPresence(value.toString());
String status = presence.getStatus();
if (status != null) status = status.toLowerCase();
int iconSize = 20;
BufferedImage img = new BufferedImage( iconSize, iconSize, BufferedImage.TYPE_INT_RGB );
Graphics g = img.getGraphics();
g.setColor( getBackground() );
g.fillRect( 0, 0, iconSize, iconSize );
if (status == null) {
g.setColor(Color.GRAY);
} else if (status.equals("available")) {
g.setColor(Color.GREEN);
} else if (status.equals("busy")) {
g.setColor(Color.ORANGE);
} else if (status.equals("error")) {
g.setColor(Color.BLACK);
} else {
g.setColor(Color.MAGENTA);
}
g.fillOval( 3, 3, iconSize-6, iconSize-6 );
String textLabel = presence.getHost() + ":" + presence.getPort();
if (presence.getName() != null) {
textLabel = presence.getName() + " (" + textLabel + ")";
}
if (textLabel.length() > maxLabelLength) {
textLabel = textLabel.substring(0, maxLabelLength-3) + "...";
}