caretUpdatePolicy

Sets how document edits affect the caret's position and scrolling.

DefaultCaret.ALWAYS_UPDATE updates the caret's position for edits on any thread. It scrolls to keep the caret visible. DefaultCaret.NEVER_UPDATE keeps the caret at its current offset without scrolling. If a removal leaves that offset past the end of the document, the caret moves to the end. DefaultCaret.UPDATE_WHEN_ON_EDT is the default. It updates the caret's position only for edits on the event dispatch thread.

Requires a DefaultCaret, including any replacement caret. Installing a caret of another type fails. The policy applies to replacement carets and is restored as described in caretBlinkRate.

Parameters

policy

the update constant written to the caret the component carries.

See also