else return String.class;
}
public Object getValueAt(int row, int column) {
PeerInfo peerInfo = peerInfoList.get(row);
if (column == 0) {
String countryCode = peerInfo.getLocation().countryCode;
ImageIcon flagIcon = null;
if (countryCode != null){
URL flagURL = ClassLoader.getSystemResource("flags/" + countryCode.toLowerCase() + ".png");
flagIcon = new ImageIcon(flagURL);
}
return flagIcon;
}
if (column == 1)
return peerInfo.getIp().getHostAddress();
if (column == 2) {
if (peerInfo.getLastAccessed() == 0)
return "?";
else
return (System.currentTimeMillis() - peerInfo.getLastAccessed()) / 1000 + " seconds ago";
}
if (column == 3) {
ImageIcon flagIcon = null;
if (peerInfo.isConnected()) {
flagIcon = Utils.getImageIcon("connected.png");
} else {
flagIcon = Utils.getImageIcon("disconnected.png");
}
return flagIcon;