- All Known Implementing Classes:
AutoCompletableTextEditor
,JEditTextArea
public interface AutoCompletableTextArea
Default interface that textarea needs to implements to define the required methods for
autocompletion
The classes that implements this interface MUST extends JComponent
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCaretListener
(CaretListener listener) Add a listener to the caret objectcreatePosition
(int length) Create the position at the position lenght.getAlreadyEnteredText
(CompletionProvider provider) Returns the text just before the current caret position that could be the start of something auto-completable.getBeginLineText
(int lineNb) Return the Text contains between the begining of the given line and the caret position.int
Return the position of the caret as int.Return the orientation of the component.int
Return the buffer size of the text areaReturn the Highlighter object of the text areaUsed by the AbstractAutoCompletion object to bind its keys actionint
Return the line of the caret.int
Return the end offset of the current selectionint
Return the start offset of the current selectiongetText
(int start, int length) Return the text at position start of given lengthvoid
Push the text at position start of given length in the given segmentGet the XY position of the caret in pixelsvoid
init()
Initializes this completion provider.void
moveCaretPosition
(int pos) Move the caret to the given positionvoid
removeCaretListener
(CaretListener listener) Remove a listener to the caret objectvoid
replaceSelection
(String content) Replace the current selection by the String contentvoid
selectText
(int start, int end) Select the text between the two position.void
setCaretPosition
(int dot) Set the position of the caret to dot
-
Method Details
-
init
void init()Initializes this completion provider. -
getAlreadyEnteredText
Returns the text just before the current caret position that could be the start of something auto-completable. -
getInputMap
InputMap getInputMap()Used by the AbstractAutoCompletion object to bind its keys action -
getActionMap
ActionMap getActionMap() -
getCaretPosition
int getCaretPosition()Return the position of the caret as int. -
setCaretPosition
void setCaretPosition(int dot) Set the position of the caret to dot -
getLineOfCaret
int getLineOfCaret()Return the line of the caret. -
selectText
void selectText(int start, int end) Select the text between the two position. -
replaceSelection
Replace the current selection by the String content- Parameters:
content
-
-
getText
Return the text at position start of given length- Throws:
BadLocationException
-
getText
Push the text at position start of given length in the given segment- Throws:
BadLocationException
-
getSelectionEnd
int getSelectionEnd()Return the end offset of the current selection -
getSelectionStart
int getSelectionStart()Return the start offset of the current selection -
createPosition
Create the position at the position lenght. If length is bigger than the buffer size it will throw an error.- Throws:
BadLocationException
-
moveCaretPosition
void moveCaretPosition(int pos) Move the caret to the given position -
getXYCaretPosition
Point getXYCaretPosition()Get the XY position of the caret in pixels -
getComponentOrientation
ComponentOrientation getComponentOrientation()Return the orientation of the component. -
addCaretListener
Add a listener to the caret object -
removeCaretListener
Remove a listener to the caret object -
getHighlighter
Highlighter getHighlighter()Return the Highlighter object of the text area -
getDocumentLength
int getDocumentLength()Return the buffer size of the text area -
getBeginLineText
Return the Text contains between the begining of the given line and the caret position. It suppose that the caret position is after the start of the line- Returns:
-