public static final class TypedTextInterceptor.MutableContext extends TypedTextInterceptor.Context
|Modifier and Type||Method and Description|
Gets the replaced text.
Gets the insertion text.
Sets the insertion text and adjusted caret position.
getComponent, getDocument, getOffset
public String getText()
It is guaranteed that the text will have length equal to 1 for contexts
that are passed to
methods. In these methods
getText returns exactly what
a user typed in the editor.
afterInsert method the text returned from
method can have any length and will correspond to either the originally typed
text or to text supplied by one of the interceptors participating in
the key typed event processing.
public void setText(String text, int caretPosition)
There is no restriction on the new text
set by this method, except that it must not be
null. It can
be of any length (including an empty string) and can even span multiple lines.
It is important to remember that the adjusted caret position is
relative to the new text. Therefore valid values for the
<0, text.getLength()>! The adjusted position
is not a document offset.
text- The new text that will be inserted to a document.
caretPosition- The adjusted caret position inside the new text. This position is relative to the new text. Valid values for this parameter are
public String getReplacedText()
The selected text is removed from document before
Built on June 22 2019. | Copyright © 2017-2019 Apache Software Foundation. All Rights Reserved.