Class TextInputGeometry
java.lang.Object
com.codename1.ui.TextInputGeometry
Immutable screen geometry for synchronous native keyboard queries. Construct on the EDT;
the native UI thread must never wait for the EDT, which can itself be waiting for drawing.
Coordinates are absolute screen pixels and document offsets are UTF-16 indices.
Input arrays and query results are copied so native readers never share mutable editor geometry.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceOptional optimized geometry provider for large custom editors. -
Constructor Summary
ConstructorsConstructorDescriptionTextInputGeometry(int[] carets, int start, int end, int[] selection, int[] fallback) Each caret record is {UTF-16 offset, x, y, width, height}. -
Method Summary
Modifier and TypeMethodDescriptionstatic TextInputGeometrycapture(TextInputClient client) Captures a bounded visible range for clients that do not provide a specialized snapshot.intoffsetAtPoint(int x, int y) Hit-tests only immutable visible geometry.int[]rectForOffset(int offset) Returns the last captured caret rectangle for an offset, or the active caret offscreen.int[]selectionRects(int a, int b) Returns exact captured selection geometry for the active range, and visible character rectangles for other native queries without touching a live editor off the EDT.
-
Constructor Details
-
TextInputGeometry
public TextInputGeometry(int[] carets, int start, int end, int[] selection, int[] fallback) Each caret record is {UTF-16 offset, x, y, width, height}. Include visible insertion positions, in document order, including the endpoint after each visible run. Selection rectangles use {x, y, width, height} records. All arrays must be non-null; carets and selection may be empty. The fallback must be the active caret's {x, y, width, height}. The start and end offsets describe the captured selection and may be in either order.
-
-
Method Details
-
capture
Captures a bounded visible range for clients that do not provide a specialized snapshot. Large editors can override TextInputGeometry.Provider to walk visual lines once. -
rectForOffset
public int[] rectForOffset(int offset) Returns the last captured caret rectangle for an offset, or the active caret offscreen. -
offsetAtPoint
public int offsetAtPoint(int x, int y) Hit-tests only immutable visible geometry. Vertical distance takes priority across lines. -
selectionRects
public int[] selectionRects(int a, int b) Returns exact captured selection geometry for the active range, and visible character rectangles for other native queries without touching a live editor off the EDT.
-