java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.gjt.sp.jedit.textarea.TextArea
org.gjt.sp.jedit.textarea.JEditTextArea
- All Implemented Interfaces:
AutoCompletableTextArea,ImageObserver,MenuContainer,Serializable,Accessible
jEdit's text component.
Unlike most other text editors, the selection API permits selection and
concurrent manipulation of multiple, non-contiguous regions of text.
Methods in this class that deal with selecting text rely upon classes derived
the Selection class.
- Version:
- $Id: JEditTextArea.java 25032 2020-03-25 23:17:29Z kpouer $
- Author:
- Slava Pestov, John Gellene (API documentation)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringFold painter service.static final StringFields inherited from class org.gjt.sp.jedit.textarea.TextArea
buffer, caret, caretLine, ELECTRIC_SCROLL, inputHandlerProvider, multi, NO_SCROLL, NORMAL_SCROLL, painter, popupFields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSurrounds the selection with explicit fold markers.voidaddTextAreaListener(TextAreaListener listener) voidCreates the popup menu.createPosition(int length) Create the position at the position lenght.voiddispose()Plugins and macros should not call this method.protected static voiddoWordCount(View view, String text) voidend(boolean select) An override to record the acutual action taken for end().static intfindWordStart(CharSequence line, int pos, CompletionProvider p) Locates the start of the word at the specified position.voidFormats the paragraph containing the caret.getAlreadyEnteredText(CompletionProvider provider) Returns the text just before the current caret position that could be the start of something auto-completable.getBeginLineText(int line) Return the Text contains between the begining of the given line and the caret position.intReturn the buffer size of the text areaprotected StringgetEmptyStringOfSize(int length) static StringReturn the Highlighter object of the text areaintReturn the line of the caret.intReturn the end offset of the current selectionintReturn the start offset of the current selectiongetView()Returns this text area's view.Get the XY position of the caret in pixelsvoidgoToBufferEnd(boolean select) Moves the caret to the end of the buffer.voidgoToBufferStart(boolean select) Moves the caret to the beginning of the buffer.voidMoves the caret to the bracket matching the one before the caret.voidDo the same thing as right-clicking on the text area.voidvoidvoidhome(boolean select) An override to record the acutual action taken for home().voidInitializes this completion provider.voidmoveCaretPositionFromXY(int x, int y) voidremoveTextAreaListener(TextAreaListener listener) voidreplaceSelection(String content) Replace the current selection by the String contentintreplaceSelection0(String selectedText) Set the selection, but does not deactivate it, and does not move the caret.voidselectText(int start, int end) Select the text between the two position.voidDisplays the 'go to line' dialog box, and moves the caret to the specified line number, or moves the caret back or forward by the offset provided.voidDisplays the 'word count' dialog box.voidsmartEnd(boolean select) An override to record the acutual action taken for smartHome().voidsmartHome(boolean select) An override to record the acutual action taken for smartHome().voiduserInput(char ch) Handles the insertion of the specified character.Methods inherited from class org.gjt.sp.jedit.textarea.TextArea
addActionSet, addBottomLeftComponent, addBottomRightComponent, addCaretListener, addExplicitFold, addLeftOfScrollBar, addNotify, addScrollListener, addStatusListener, addStructureMatcher, addTopComponent, addTopLeftComponent, addTopRightComponent, addToSelection, addToSelection, backspace, backspaceWord, backspaceWord, backspaceWord, blinkCaret, caretAutoScroll, centerCaret, collapseFold, collapseFold, delete, deleteLine, deleteParagraph, deleteToEndOfLine, deleteToStartOfLine, deleteWord, deleteWord, doWordWrap, expandFold, extendSelection, extendSelection, getActionContext, getBuffer, getBufferLength, getCaretLine, getCaretPosition, getDisplayManager, getElectricScroll, getFirstLine, getFirstPhysicalLine, getFocusCycleRoot, getFocusTraversalKeysEnabled, getGutter, getHorizontalOffset, getInputHandler, getInputMethodRequests, getJoinNonWordChars, getLastPhysicalLine, getLastScreenLine, getLineCount, getLineEndOffset, getLineLength, getLineOfOffset, getLineStartOffset, getLineText, getLineText, getMagicCaretPosition, getMarkPosition, getPainter, getPhysicalLineOfScreenLine, getRightClickPopup, getScreenLineEndOffset, getScreenLineOfOffset, getScreenLineStartOffset, getSelectedLines, getSelectedText, getSelectedText, getSelectedText, getSelection, getSelection, getSelectionAtOffset, getSelectionCount, getSelectionIterator, getStructureMatch, getTabExpander, getText, getText, getText, getVisibleLines, getVisibleLineSegment, getVisibleLineText, getVisibleLineText, goToEndOfCode, goToEndOfLine, goToEndOfWhiteSpace, goToFirstVisibleLine, goToLastVisibleLine, goToNextBracket, goToNextCharacter, goToNextFold, goToNextLine, goToNextPage, goToNextParagraph, goToNextWord, goToNextWord, goToParentFold, goToPrevBracket, goToPrevCharacter, goToPrevFold, goToPrevLine, goToPrevPage, goToPrevParagraph, goToPrevWord, goToPrevWord, goToPrevWord, goToStartOfLine, goToStartOfWhiteSpace, indentSelectedLines, initInputHandler, insert, insertEnterAndIndent, insertTabAndIndent, invalidateLine, invalidateLineRange, invalidateScreenLineRange, invertSelection, isCaretBlinkEnabled, isCaretVisible, isCtrlForRectangularSelection, isDragEnabled, isEditable, isMultipleSelectionEnabled, isOverwriteEnabled, isQuickCopyEnabled, isRectangularSelectionEnabled, isRightClickPopupEnabled, isStructureHighlightVisible, joinLines, lineComment, lineInStructureScope, moveCaretPosition, moveCaretPosition, moveCaretPosition, narrowToFold, narrowToSelection, offsetToXY, offsetToXY, offsetToXY, processKeyEvent, propertiesChanged, rangeComment, removeCaretListener, removeFromSelection, removeFromSelection, removeLeftOfScrollBar, removeNotify, removeScrollListener, removeStatusListener, removeStructureMatcher, removeTopComponent, removeTrailingWhiteSpace, resizeSelection, scrollAndCenterCaret, scrollDownLine, scrollDownPage, scrollTo, scrollTo, scrollToCaret, scrollUpLine, scrollUpPage, selectAll, selectBlock, selectFold, selectFold, selectLine, selectNone, selectParagraph, selectToMatchingBracket, selectToMatchingBracket, selectWord, setBuffer, setCaretBlinkEnabled, setCaretPosition, setCaretPosition, setCtrlForRectangularSelection, setDragEnabled, setElectricScroll, setFirstLine, setFirstPhysicalLine, setFirstPhysicalLine, setHorizontalOffset, setJoinNonWordChars, setMagicCaretPosition, setMouseHandler, setMultipleSelectionEnabled, setOverwriteEnabled, setQuickCopyEnabled, setRectangularSelectionEnabled, setRightClickPopup, setRightClickPopupEnabled, setSelectedText, setSelectedText, setSelectedText, setSelection, setSelection, setText, setTransferHandler, shiftIndentLeft, shiftIndentRight, showPopupMenu, showPopupMenu, spacesToTabs, tabsToSpaces, toggleMultipleSelectionEnabled, toggleOverwriteEnabled, toggleRectangularSelectionEnabled, toLowerCase, toString, toUpperCase, turnOnElasticTabstops, userInputTab, xToScreenLineOffset, xyToOffset, xyToOffsetMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.grogra.pf.ui.autocomplete.AutoCompletableTextArea
addCaretListener, getActionMap, getCaretPosition, getComponentOrientation, getInputMap, getText, getText, moveCaretPosition, removeCaretListener, setCaretPosition
-
Field Details
-
FOLD_PAINTER_PROPERTY
Fold painter service.- Since:
- jEdit 4.3pre16
- See Also:
-
FOLD_PAINTER_SERVICE
- See Also:
-
DEFAULT_FOLD_PAINTER_SERVICE
- See Also:
-
-
Constructor Details
-
JEditTextArea
Creates a new JEditTextArea.
-
-
Method Details
-
dispose
public void dispose()Description copied from class:TextAreaPlugins and macros should not call this method. -
getFoldPainter
- Overrides:
getFoldPainterin classTextArea
-
home
public void home(boolean select) An override to record the acutual action taken for home(). -
end
public void end(boolean select) An override to record the acutual action taken for end(). -
smartHome
public void smartHome(boolean select) An override to record the acutual action taken for smartHome(). -
smartEnd
public void smartEnd(boolean select) An override to record the acutual action taken for smartHome(). -
goToBufferEnd
public void goToBufferEnd(boolean select) Description copied from class:TextAreaMoves the caret to the end of the buffer.- Overrides:
goToBufferEndin classTextArea- Parameters:
select- true if you want to extend selection
-
goToMatchingBracket
public void goToMatchingBracket()Moves the caret to the bracket matching the one before the caret. Also sends PositionChanging if it goes somewhere.- Overrides:
goToMatchingBracketin classTextArea- Since:
- jEdit 4.3pre18
-
goToBufferStart
public void goToBufferStart(boolean select) Description copied from class:TextAreaMoves the caret to the beginning of the buffer.- Overrides:
goToBufferStartin classTextArea- Parameters:
select- true if you want to extend selection
-
replaceSelection0
Description copied from class:TextAreaSet the selection, but does not deactivate it, and does not move the caret. Please useTextArea.setSelectedText(String)instead.- Overrides:
replaceSelection0in classTextArea- Parameters:
selectedText- The new selection- Returns:
- The new caret position
-
showGoToLineDialog
public void showGoToLineDialog()Displays the 'go to line' dialog box, and moves the caret to the specified line number, or moves the caret back or forward by the offset provided.- Since:
- jEdit 2.7pre2
-
userInput
public void userInput(char ch) Handles the insertion of the specified character. It performs the following operations in addition to TextArea#userInput(char):- Inserting a space with automatic abbrev expansion enabled will try to expand the abbrev
-
addExplicitFold
public void addExplicitFold()Surrounds the selection with explicit fold markers.- Overrides:
addExplicitFoldin classTextArea- Since:
- jEdit 4.0pre3
-
formatParagraph
public void formatParagraph()Formats the paragraph containing the caret.- Overrides:
formatParagraphin classTextArea- Since:
- jEdit 2.7pre2
-
doWordCount
-
showWordCountDialog
public void showWordCountDialog()Displays the 'word count' dialog box.- Since:
- jEdit 2.7pre2
-
getView
Returns this text area's view.- Since:
- jEdit 4.2pre5
-
getFoldPainterName
-
handlePopupTrigger
Do the same thing as right-clicking on the text area. The Gestures plugin uses this API.- Overrides:
handlePopupTriggerin classTextArea- Since:
- jEdit 4.2pre13
-
createPopupMenu
Creates the popup menu.- Overrides:
createPopupMenuin classTextArea- Since:
- 4.3pre15
-
handlePropertiesChanged
-
getAlreadyEnteredText
Description copied from interface:AutoCompletableTextAreaReturns the text just before the current caret position that could be the start of something auto-completable.- Specified by:
getAlreadyEnteredTextin interfaceAutoCompletableTextArea
-
findWordStart
Locates the start of the word at the specified position. -
initCompletionProvider
public void initCompletionProvider()Description copied from interface:AutoCompletableTextAreaInitializes this completion provider.- Specified by:
initCompletionProviderin interfaceAutoCompletableTextArea
-
moveCaretPositionFromXY
public void moveCaretPositionFromXY(int x, int y) - Specified by:
moveCaretPositionFromXYin interfaceAutoCompletableTextArea
-
getXYCaretPosition
Description copied from interface:AutoCompletableTextAreaGet the XY position of the caret in pixels- Specified by:
getXYCaretPositionin interfaceAutoCompletableTextArea
-
getLineOfCaret
public int getLineOfCaret()Description copied from interface:AutoCompletableTextAreaReturn the line of the caret.- Specified by:
getLineOfCaretin interfaceAutoCompletableTextArea
-
replaceSelection
Description copied from interface:AutoCompletableTextAreaReplace the current selection by the String content- Specified by:
replaceSelectionin interfaceAutoCompletableTextArea- Parameters:
content-
-
selectText
public void selectText(int start, int end) Description copied from interface:AutoCompletableTextAreaSelect the text between the two position.- Specified by:
selectTextin interfaceAutoCompletableTextArea
-
getHighlighter
Description copied from interface:AutoCompletableTextAreaReturn the Highlighter object of the text area- Specified by:
getHighlighterin interfaceAutoCompletableTextArea
-
getSelectionEnd
public int getSelectionEnd()Description copied from interface:AutoCompletableTextAreaReturn the end offset of the current selection- Specified by:
getSelectionEndin interfaceAutoCompletableTextArea
-
getSelectionStart
public int getSelectionStart()Description copied from interface:AutoCompletableTextAreaReturn the start offset of the current selection- Specified by:
getSelectionStartin interfaceAutoCompletableTextArea
-
getDocumentLength
public int getDocumentLength()Description copied from interface:AutoCompletableTextAreaReturn the buffer size of the text area- Specified by:
getDocumentLengthin interfaceAutoCompletableTextArea
-
createPosition
Description copied from interface:AutoCompletableTextAreaCreate the position at the position lenght. If length is bigger than the buffer size it will throw an error.- Specified by:
createPositionin interfaceAutoCompletableTextArea- Throws:
BadLocationException
-
getEmptyStringOfSize
-
getBeginLineText
Description copied from interface:AutoCompletableTextAreaReturn 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- Specified by:
getBeginLineTextin interfaceAutoCompletableTextArea- Returns:
-
addTextAreaListener
- Specified by:
addTextAreaListenerin interfaceAutoCompletableTextArea
-
removeTextAreaListener
- Specified by:
removeTextAreaListenerin interfaceAutoCompletableTextArea
-
highlightscope
public void highlightscope()
-