private void editKey(ECKey key, int row) throws BlockStoreException {
   Address addr = key.toAddress();
   while (true) {
     addr = AddressEditDialog.showDialog(this, addr, false);
     if (addr == null) break;
     String label = addr.getLabel();
     boolean valid = true;
     synchronized (BTCLoader.lock) {
       for (ECKey chkKey : BTCLoader.keys) {
         if (chkKey == key) continue;
         if (chkKey.getLabel().compareToIgnoreCase(label) == 0) {
           JOptionPane.showMessageDialog(
               this, "Duplicate name specified", "Error", JOptionPane.ERROR_MESSAGE);
           valid = false;
           break;
         }
       }
       if (valid) {
         if (row >= 0) BTCLoader.keys.remove(row);
         boolean added = false;
         for (int i = 0; i < BTCLoader.keys.size(); i++) {
           ECKey chkKey = BTCLoader.keys.get(i);
           if (chkKey.getLabel().compareToIgnoreCase(label) > 0) {
             key.setLabel(label);
             BTCLoader.keys.add(i, key);
             added = true;
             break;
           }
         }
         if (!added) {
           key.setLabel(label);
           BTCLoader.keys.add(key);
         }
       }
     }
     if (valid) {
       if (row >= 0) {
         BTCLoader.blockStore.setKeyLabel(key);
       } else {
         BTCLoader.blockStore.storeKey(key);
         BTCLoader.bloomFilter.insert(key.getPubKey());
         BTCLoader.bloomFilter.insert(key.getPubKeyHash());
         Message filterMsg = FilterLoadMessage.buildFilterLoadMessage(null, BTCLoader.bloomFilter);
         BTCLoader.networkHandler.broadcastMessage(filterMsg);
       }
       tableModel.fireTableDataChanged();
       break;
     }
   }
 }
 @Override
 public Object getValueAt(int row, int column) {
   if (row >= BTCLoader.keys.size()) {
     throw new IndexOutOfBoundsException("Table row " + row + " is not valid");
   }
   Object value;
   ECKey key = BTCLoader.keys.get(row);
   switch (column) {
     case 0:
       value = key.getLabel();
       break;
     case 1:
       value = key.toAddress().toString();
       break;
     default:
       throw new IndexOutOfBoundsException("Table column " + column + " is not valid");
   }
   return value;
 }