public int getLinkIndex(int charIndex) {
if (linksValid == false) {
buildLinkTable();
}
Element e = null;
Document doc = JEditorPane.this.getDocument();
if (doc != null) {
for (e = doc.getDefaultRootElement(); ! e.isLeaf(); ) {
int index = e.getElementIndex(charIndex);
e = e.getElement(index);
}
}
// don't need to verify that it's an HREF element; if
// not, then it won't be in the hyperlinks Vector, and
// so indexOf will return -1 in any case
return hyperlinks.baseElementIndex(e);
}
Returns the index into an array of hyperlinks that
is associated with this character index, or -1 if there
is no hyperlink associated with this index. |