float h; i = keys.iterator(); int size = keys.size(); for (int j = 0; j < size; j++) { h = (float) j / (float) size; Object key = i.next(); Object color = Color.getHSBColor(h, 1.0f, 1.0f); _table.put(key, color);   _legendListModel.addElement(new Pair(key, color)); }
_legendListModel = createListModel(keys);
	public void initialize(Graph g, String datumName) {		_datumName = datumName;		_g = g;		_table = new Hashtable();		_legendListModel = new DefaultListModel();				// figure out how many unique entries there are		Set keys = new HashSet();		Iterator i = g.getVertices().iterator();		while(i.hasNext()) {			Vertex v = (Vertex) i.next();			if(v.getDatum(_datumName) == null) {				continue;			}			keys.add(v.getDatum(_datumName).get());		}		// automatically assign colors to everything		float h;		i = keys.iterator();		int size = keys.size();		for (int j = 0; j < size; j++) {			h = (float) j / (float) size;			Object key = i.next();			Object color = Color.getHSBColor(h, 1.0f, 1.0f);			_table.put(key, color);									/* add the new legend element to the legend list.  The			 * legend list takes a Pair object, the car() is the key			 * and the color is the cdr(). */			_legendListModel.addElement(new Pair(key, color));		}	}