public int getPosition(Component c) {
		if (c == null)
			return -1;
		if (getDocument() == null)
			return -1;
		if (getDocument().getLength() <= 0)
			return -1;
		AbstractDocument.BranchElement section = (AbstractDocument.BranchElement) getDocument().getDefaultRootElement();
		AbstractDocument.BranchElement paragraph = null;
		AbstractDocument.LeafElement content = null;
		Object attr = null;
		for (Enumeration i = section.children(); i.hasMoreElements();) {
			paragraph = (AbstractDocument.BranchElement) i.nextElement();
			for (Enumeration j = paragraph.children(); j.hasMoreElements();) {
				content = (AbstractDocument.LeafElement) j.nextElement();
				for (Enumeration k = content.getAttributeNames(); k.hasMoreElements();) {
					attr = content.getAttribute(k.nextElement());
					if (c == attr)
						return content.getEndOffset();
				}
			}
		}
		return -1;
	}