Top Description Fields Constructors Methods
org.fxmisc.richtext

public Class CharacterHit

extends Object
Class Inheritance
Imports
java.util.OptionalInt

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).

Field Summary

Modifier and TypeField and Description
private final OptionalInt
private final int

Constructor Summary

AccessConstructor and Description
private
CharacterHit(OptionalInt charIdx, int insertionIndex)

Method Summary

Modifier and TypeMethod and Description
public OptionalInt
getCharacterIndex()

Returns an OptionalInt whose 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.

public int
getInsertionIndex()

When getCharacterIndex() is present, returns either the same value as getCharacterIndex() when the character index is leading and getCharacterIndex() + 1 when the index is trailing.

public static CharacterHit
insertionAt(int insertionIndex)

Returns a CharacterHit for 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)

public static CharacterHit
leadingHalfOf(int charIdx)

Returns a CharacterHit for 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.

public CharacterHit
offset(int offsetAmount)

Offsets the values stored in this CharacterHit by the given amount

public static CharacterHit
trailingHalfOf(int charIdx)

Returns a CharacterHit for 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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

charIdxback to summary
private final OptionalInt charIdx
insertionIndexback to summary
private final int insertionIndex

Constructor Detail

CharacterHitback to summary
private CharacterHit(OptionalInt charIdx, int insertionIndex)

Method Detail

getCharacterIndexback to summary
public OptionalInt getCharacterIndex()

Returns an OptionalInt whose 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.

getInsertionIndexback to summary
public int getInsertionIndex()

When getCharacterIndex() is present, returns either the same value as getCharacterIndex() when the character index is leading and getCharacterIndex() + 1 when the index is trailing. When getCharacterIndex() is absent, returns the bounds of that visible entity (either 0 or the length of the area, the length of a paragraph, or the character count of a line).

insertionAtback to summary
public static CharacterHit insertionAt(int insertionIndex)

Returns a CharacterHit for 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)

leadingHalfOfback to summary
public static CharacterHit leadingHalfOf(int charIdx)

Returns a CharacterHit for 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.

offsetback to summary
public CharacterHit offset(int offsetAmount)

Offsets the values stored in this CharacterHit by the given amount

trailingHalfOfback to summary
public static CharacterHit trailingHalfOf(int charIdx)

Returns a CharacterHit for 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.