Package org.fxmisc.richtext
Class CharacterHit
- java.lang.Object
-
- org.fxmisc.richtext.CharacterHit
-
public class CharacterHit extends Object
Object that stores information relating to the position in an area's content that corresponds to a given position in some visible entity (e.g. the area, a paragraph in the area, a line on a paragraph).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OptionalIntgetCharacterIndex()Returns anOptionalIntwhose value is present when the hit occurs within the visible entity and is the index of the closest character to the give position on the screen.intgetInsertionIndex()WhengetCharacterIndex()is present, returns either the same value asgetCharacterIndex()when the character index is leading andgetCharacterIndex() + 1when the index is trailing.static CharacterHitinsertionAt(int insertionIndex)Returns aCharacterHitfor cases where the insertion occurs outside the bounds of some visible entity (e.g.static CharacterHitleadingHalfOf(int charIdx)Returns aCharacterHitfor cases where the hit occurs inside the bounds of some visible entity (e.g.CharacterHitoffset(int offsetAmount)Offsets the values stored in thisCharacterHitby the given amountstatic CharacterHittrailingHalfOf(int charIdx)Returns aCharacterHitfor cases where the hit occurs inside the bounds of some visible entity (e.g.
-
-
-
Method Detail
-
insertionAt
public static CharacterHit insertionAt(int insertionIndex)
Returns aCharacterHitfor cases where the insertion occurs outside the bounds of some visible entity (e.g. the area, the paragraph in an area, the line in a paragraph)
-
leadingHalfOf
public static CharacterHit leadingHalfOf(int charIdx)
Returns aCharacterHitfor cases where the hit occurs inside the bounds of some visible entity (e.g. the area, the paragraph in an area, the line in a paragraph) and the character is leading.
-
trailingHalfOf
public static CharacterHit trailingHalfOf(int charIdx)
Returns aCharacterHitfor cases where the hit occurs inside the bounds of some visible entity (e.g. the area, the paragraph in an area, the line in a paragraph) and the character is trailing.
-
getCharacterIndex
public OptionalInt getCharacterIndex()
Returns anOptionalIntwhose value is present when the hit occurs within the visible entity and is the index of the closest character to the give position on the screen.
-
getInsertionIndex
public int getInsertionIndex()
WhengetCharacterIndex()is present, returns either the same value asgetCharacterIndex()when the character index is leading andgetCharacterIndex() + 1when the index is trailing. WhengetCharacterIndex()is absent, returns the bounds of that visible entity (either0or the length of the area, the length of a paragraph, or the character count of a line).
-
offset
public CharacterHit offset(int offsetAmount)
Offsets the values stored in thisCharacterHitby the given amount
-
-