Methods Summary |
---|
public static java.awt.font.TextHitInfo | afterOffset(int offset)Creates a TextHitInfo at the specified offset,
associated with the character after the offset.
return new TextHitInfo(offset, true);
|
public static java.awt.font.TextHitInfo | beforeOffset(int offset)Creates a TextHitInfo at the specified offset,
associated with the character before the offset.
return new TextHitInfo(offset-1, false);
|
public boolean | equals(java.lang.Object obj)Returns true if the specified Object is a
TextHitInfo and equals this TextHitInfo .
return (obj instanceof TextHitInfo) && equals((TextHitInfo)obj);
|
public boolean | equals(java.awt.font.TextHitInfo hitInfo)Returns true if the specified TextHitInfo
has the same charIndex and isLeadingEdge
as this TextHitInfo . This is not the same as having
the same insertion offset.
return hitInfo != null && charIndex == hitInfo.charIndex &&
isLeadingEdge == hitInfo.isLeadingEdge;
|
public int | getCharIndex()Returns the index of the character hit.
return charIndex;
|
public int | getInsertionIndex()Returns the insertion index. This is the character index if
the leading edge of the character was hit, and one greater
than the character index if the trailing edge was hit.
return isLeadingEdge ? charIndex : charIndex + 1;
|
public java.awt.font.TextHitInfo | getOffsetHit(int delta)Creates a TextHitInfo whose character index is offset
by delta from the charIndex of this
TextHitInfo . This TextHitInfo remains
unchanged.
return new TextHitInfo(charIndex + delta, isLeadingEdge);
|
public java.awt.font.TextHitInfo | getOtherHit()Creates a TextHitInfo on the other side of the
insertion point. This TextHitInfo remains unchanged.
if (isLeadingEdge) {
return trailing(charIndex - 1);
} else {
return leading(charIndex + 1);
}
|
public int | hashCode()Returns the hash code.
return charIndex;
|
public boolean | isLeadingEdge()Returns true if the leading edge of the character was
hit.
return isLeadingEdge;
|
public static java.awt.font.TextHitInfo | leading(int charIndex)Creates a TextHitInfo on the leading edge of the
character at the specified charIndex .
return new TextHitInfo(charIndex, true);
|
public java.lang.String | toString()Returns a String representing the hit for debugging
use only.
return "TextHitInfo[" + charIndex + (isLeadingEdge ? "L" : "T")+"]";
|
public static java.awt.font.TextHitInfo | trailing(int charIndex)Creates a hit on the trailing edge of the character at
the specified charIndex .
return new TextHitInfo(charIndex, false);
|