NavigationFilter can be used to restrict where the cursor can
be positioned. When the default cursor positioning actions attempt to
reposition the cursor they will call into the
NavigationFilter, assuming
the JTextComponent has a non-null
NavigationFilter set. In this manner
the NavigationFilter can effectively restrict where the
cursor can be positioned. Similarly DefaultCaret will call
into the NavigationFilter when the user is changing the
selection to further restrict where the cursor can be positioned.
Subclasses can conditionally call into supers implementation to restrict
where the cursor can be placed, or call directly into the
FilterBypass.
javax.swing.text.Caret , javax.swing.text.DefaultCaret , javax.swing.text.View
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | NavigationFilter.
Used as a way to circumvent calling back into the caret to position the cursor. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the location within the model that best represents the next location visual positionJTextComponent containing text text, int Position used in determining next position pos, Position.Bias used in determining next position bias,the direction from the current position that can
be thought of as the arrow keys typically found on a keyboard.
This will be one of the following values:
direction, Position.
Used to return resulting Bias of next position biasRetReturns the next visual position to place the caret at from an existing position. |
| public void | moveDot(NavigationFilter.
FilterBypass that can be used to mutate caret position fb,the position >= 0 dot, Position.Bias for new location biasInvoked prior to the Caret moving the dot. |
| public void | setDot(NavigationFilter.
FilterBypass that can be used to mutate caret position fb,the position >= 0 dot, Position.Bias to place the dot at biasInvoked prior to the Caret setting the dot. |
| NavigationFilter | back to summary |
|---|---|
| public NavigationFilter() Constructs a | |
| getNextVisualPositionFrom | back to summary |
|---|---|
| public int getNextVisualPositionFrom(JTextComponent text, int pos, Position. Returns the next visual position to place the caret at from an existing position. The default implementation simply forwards the method to the root View. Subclasses may wish to further restrict the location based on additional criteria.
| |
| moveDot | back to summary |
|---|---|
| public void moveDot(NavigationFilter. Invoked prior to the Caret moving the dot. The default implementation
calls directly into the
| |
| setDot | back to summary |
|---|---|
| public void setDot(NavigationFilter. Invoked prior to the Caret setting the dot. The default implementation
calls directly into the
| |