Vector items = object.getItems(); if ((items==null) || (items.size()==0)) return;  Object obj; Enumeration e = items.elements(); while (e.hasMoreElements()) { obj = e.nextElement(); if (obj instanceof JMenuItem) add((JMenuItem)obj); else if (obj instanceof JSeparator) add((JSeparator)obj); }
if (object instanceof Flexible) populateWithFlexible((Flexible)object, items);
public void show(Popupable object, JComponent component, int x, int y) {	setLabel(object.getLabel());	if (getComponentCount()>0) removeAll();	// add object items	Vector items = object.getItems();	if ((items==null) || (items.size()==0)) return;			Object obj;	Enumeration e = items.elements();	while (e.hasMoreElements())	{		obj = e.nextElement();		if (obj instanceof JMenuItem)			add((JMenuItem)obj);		else if (obj instanceof JSeparator)			add((JSeparator)obj);	}	addPluginItems(this, object);	// show popup menu	show(component, x, y);}