public abstract class TextArea
extends javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected JEditBuffer |
buffer |
protected int |
caret |
protected int |
caretLine |
static int |
ELECTRIC_SCROLL |
protected InputHandlerProvider |
inputHandlerProvider |
protected boolean |
multi
Flag that tells if multiple selection is on.
|
static int |
NO_SCROLL |
static int |
NORMAL_SCROLL |
protected TextAreaPainter |
painter |
protected javax.swing.JPopupMenu |
popup |
TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Modifier | Constructor and Description |
---|---|
protected |
TextArea(IPropertyManager propertyManager,
InputHandlerProvider inputHandlerProvider)
Creates a new JEditTextArea.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionSet(JEditActionSet<JEditBeanShellAction> actionSet)
Adds a new action set to the textarea's list of ActionSets.
|
void |
addBottomLeftComponent(java.awt.Component comp)
Adds a component below the gutter.
|
void |
addBottomRightComponent(java.awt.Component comp)
Adds a component below the vertical scroll bar.
|
void |
addCaretListener(javax.swing.event.CaretListener listener)
Adds a caret change listener to this text area.
|
void |
addExplicitFold()
Surrounds the selection with explicit fold markers.
|
protected int |
addExplicitFold(int caretStart,
int caretEnd,
int lineStart,
int lineEnd)
Add an explicit fold.
|
void |
addLeftOfScrollBar(java.awt.Component comp)
Adds a component to the left side of the box left of the vertical
scroll bar.
|
void |
addNotify()
Called by the AWT when this component is added to a parent.
|
void |
addScrollListener(ScrollListener listener)
Adds a scroll listener to this text area.
|
void |
addStatusListener(StatusListener listener)
Adds a scroll listener to this text area.
|
void |
addStructureMatcher(StructureMatcher matcher)
Adds a structure matcher.
|
void |
addTopComponent(java.awt.Component comp)
Adds a component above the gutter, text area, and vertical scroll bar.
|
void |
addTopLeftComponent(java.awt.Component comp)
Adds a component above the gutter.
|
void |
addTopRightComponent(java.awt.Component comp)
Adds a component above the vertical scroll bar.
|
void |
addToSelection(Selection selection)
Adds to the selection.
|
void |
addToSelection(Selection[] selection)
Adds to the selection.
|
void |
backspace()
Deletes the character before the caret, or the selection, if one is
active.
|
void |
backspaceWord()
Deletes the word before the caret.
|
void |
backspaceWord(boolean eatWhitespace)
Deletes the word before the caret.
|
void |
backspaceWord(boolean eatWhitespace,
boolean eatOnlyAfterWord)
Deletes the word before the caret.
|
void |
blinkCaret()
Blinks the caret.
|
boolean |
caretAutoScroll()
Return if change in buffer should scroll this text area.
|
void |
centerCaret()
Centers the caret on the screen.
|
void |
collapseFold()
Like
DisplayManager.collapseFold(int) , but
also moves the caret to the first line of the fold. |
void |
collapseFold(int line)
Like
DisplayManager.collapseFold(int) , but
also moves the caret to the first line of the fold. |
void |
createPopupMenu(java.awt.event.MouseEvent evt)
Creates the popup menu.
|
void |
delete()
Deletes the character after the caret.
|
void |
deleteLine()
Deletes the line containing the caret.
|
void |
deleteParagraph()
Deletes the paragraph containing the caret.
|
void |
deleteToEndOfLine()
Deletes from the caret to the end of the current line.
|
void |
deleteToStartOfLine()
Deletes from the caret to the beginning of the current line.
|
void |
deleteWord()
Deletes the word in front of the caret.
|
void |
deleteWord(boolean eatWhitespace)
Deletes the word in front of the caret.
|
void |
dispose()
Plugins and macros should not call this method.
|
protected boolean |
doWordWrap(boolean spaceInserted)
Does hard wrap.
|
void |
end(boolean select)
a dumb end action which only has 2 states:
end of whitespace or end of line
|
void |
expandFold(boolean fully)
Like
DisplayManager.expandFold(int,boolean) , but
also moves the caret to the first sub-fold. |
void |
extendSelection(int offset,
int end)
Extends the selection at the specified offset, or creates a new
one if there is no selection at the specified offset.
|
void |
extendSelection(int offset,
int end,
int extraStartVirt,
int extraEndVirt)
Extends the selection at the specified offset, or creates a new
one if there is no selection at the specified offset.
|
void |
formatParagraph()
Formats the paragraph containing the caret.
|
JEditActionContext<JEditBeanShellAction,JEditActionSet<JEditBeanShellAction>> |
getActionContext() |
JEditBuffer |
getBuffer()
Returns the buffer this text area is editing.
|
int |
getBufferLength()
Returns the length of the buffer.
|
int |
getCaretLine()
Returns the line number containing the caret.
|
int |
getCaretPosition()
Returns a zero-based index of the caret position.
|
DisplayManager |
getDisplayManager() |
int |
getElectricScroll() |
int |
getFirstLine()
Returns the vertical scroll bar position.
|
int |
getFirstPhysicalLine()
Returns the first visible physical line index.
|
boolean |
getFocusCycleRoot()
Java 1.4 compatibility fix to make Tab traversal work in a sane
manner.
|
boolean |
getFocusTraversalKeysEnabled()
Java 1.4 compatibility fix to make Tab key work.
|
FoldPainter |
getFoldPainter() |
Gutter |
getGutter()
Returns the gutter to the left of the text area or null if the gutter
is disabled
|
int |
getHorizontalOffset()
Returns the horizontal offset of drawn lines.
|
AbstractInputHandler |
getInputHandler() |
java.awt.im.InputMethodRequests |
getInputMethodRequests() |
boolean |
getJoinNonWordChars()
If set, double clicking will join non-word characters to form one "word".
|
int |
getLastPhysicalLine()
Returns the last visible physical line index.
|
int |
getLastScreenLine()
Returns the last screen line index, it is different from
getVisibleLines() because the buffer can have less lines than
the visible lines |
int |
getLineCount()
Returns the number of physical lines in the buffer.
|
int |
getLineEndOffset(int line)
Returns the end offset of the specified line.
|
int |
getLineLength(int line)
Returns the length of the specified line.
|
int |
getLineOfOffset(int offset)
Returns the line containing the specified offset.
|
int |
getLineStartOffset(int line)
Returns the start offset of the specified line.
|
java.lang.String |
getLineText(int lineIndex)
Returns the text on the specified line.
|
void |
getLineText(int lineIndex,
javax.swing.text.Segment segment)
Copies the text on the specified line into a Segment.
|
int |
getMagicCaretPosition()
Returns an internal position used to keep the caret in one
column while moving around lines of varying lengths.
|
int |
getMarkPosition()
Deprecated.
Do not use.
|
TextAreaPainter |
getPainter()
Returns the object responsible for painting this text area.
|
int |
getPhysicalLineOfScreenLine(int screenLine)
Returns the physical line number that contains the specified screen
line.
|
javax.swing.JPopupMenu |
getRightClickPopup()
Returns the right click popup menu.
|
int |
getScreenLineEndOffset(int line)
Returns the end offset of the specified screen (wrapped) line.
|
int |
getScreenLineOfOffset(int offset)
Returns the screen (wrapped) line containing the specified offset.
|
int |
getScreenLineStartOffset(int line)
Returns the start offset of the specified screen (wrapped) line.
|
int[] |
getSelectedLines()
Returns a sorted array of line numbers on which a selection or
selections are present.
|
java.lang.String |
getSelectedText()
Returns the text in all active selections, with a newline
between each text chunk.
|
java.lang.String |
getSelectedText(Selection s)
Returns the text in the specified selection.
|
java.lang.String |
getSelectedText(java.lang.String separator)
Returns the text in all active selections.
|
Selection[] |
getSelection()
Returns the current selection.
|
Selection |
getSelection(int index)
Returns the selection with the specified index.
|
Selection |
getSelectionAtOffset(int offset)
Returns the selection containing the specific offset, or
null
if there is no selection at that offset. |
int |
getSelectionCount()
Returns the number of selections.
|
java.util.Iterator<Selection> |
getSelectionIterator()
Returns the current selection.
|
StructureMatcher.Match |
getStructureMatch()
Returns the structure element (bracket, or XML tag, etc) matching the
one before the caret.
|
javax.swing.text.TabExpander |
getTabExpander() |
java.lang.String |
getText()
Returns the entire text of this text area.
|
java.lang.String |
getText(int start,
int len)
Returns the specified substring of the buffer.
|
void |
getText(int start,
int len,
javax.swing.text.Segment segment)
Copies the specified substring of the buffer into a segment.
|
int |
getVisibleLines()
Returns the number of lines visible in this text area.
|
java.lang.CharSequence |
getVisibleLineSegment(int screenLine)
Returns the visible part of the given line in a CharSequence.
|
java.lang.String |
getVisibleLineText(int screenLine)
Returns the visible part of the given line
|
void |
getVisibleLineText(int screenLine,
javax.swing.text.Segment segment)
Returns the visible part of the given line
|
void |
goToBufferEnd(boolean select)
Moves the caret to the end of the buffer.
|
void |
goToBufferStart(boolean select)
Moves the caret to the beginning of the buffer.
|
void |
goToEndOfCode(boolean select)
Moves the caret to the end of the code present on the current line, before the comments and whitespace.
|
void |
goToEndOfLine(boolean select)
Moves the caret to the end of the current line.
|
void |
goToEndOfWhiteSpace(boolean select)
Moves the caret to the last non-whitespace character of the current
line.
|
void |
goToFirstVisibleLine(boolean select)
Moves the caret to the first visible line.
|
void |
goToLastVisibleLine(boolean select)
Moves the caret to the last visible line.
|
void |
goToMatchingBracket()
Moves the caret to the bracket matching the one before the caret.
|
void |
goToNextBracket(boolean select)
Moves the caret to the next closing bracket.
|
void |
goToNextCharacter(boolean select)
Moves the caret to the next character.
|
void |
goToNextFold(boolean select)
Moves the caret to the next fold.
|
void |
goToNextLine(boolean select)
Move the caret to the next line.
|
void |
goToNextPage(boolean select)
Moves the caret to the next screenful.
|
void |
goToNextParagraph(boolean select)
Moves the caret to the start of the next paragraph.
|
void |
goToNextWord(boolean select)
Moves the caret to the start of the next word.
|
void |
goToNextWord(boolean select,
boolean eatWhitespace)
Moves the caret to the start of the next word.
|
void |
goToParentFold()
Moves the caret to the fold containing the one at the caret
position.
|
void |
goToPrevBracket(boolean select)
Moves the caret to the previous bracket.
|
void |
goToPrevCharacter(boolean select)
Moves the caret to the previous character.
|
void |
goToPrevFold(boolean select)
Moves the caret to the previous fold.
|
void |
goToPrevLine(boolean select)
Moves the caret to the previous line.
|
void |
goToPrevPage(boolean select)
Moves the caret to the previous screenful.
|
void |
goToPrevParagraph(boolean select)
Moves the caret to the start of the previous paragraph.
|
void |
goToPrevWord(boolean select)
Moves the caret to the start of the previous word.
|
void |
goToPrevWord(boolean select,
boolean eatWhitespace)
Moves the caret to the start of the previous word.
|
void |
goToPrevWord(boolean select,
boolean eatWhitespace,
boolean eatOnlyAfterWord)
Moves the caret to the start of the previous word.
|
void |
goToStartOfLine(boolean select)
Moves the caret to the beginning of the current line.
|
void |
goToStartOfWhiteSpace(boolean select)
Moves the caret to the first non-whitespace character of the current
line.
|
void |
handlePopupTrigger(java.awt.event.MouseEvent evt)
Do the same thing as right-clicking on the text area.
|
void |
home(boolean select)
A "dumb home" action which only has 2 states:
start of the whitespace or start of line
|
void |
indentSelectedLines()
Indents all selected lines.
|
void |
initInputHandler()
Creates an actionContext and initializes the input
handler for this textarea.
|
protected void |
insert(java.lang.String str,
boolean indent) |
void |
insertEnterAndIndent()
Inserts a line break and indents the new line.
|
void |
insertTabAndIndent() |
void |
invalidateLine(int line)
Marks a line as needing a repaint.
|
void |
invalidateLineRange(int start,
int end)
Marks a range of physical lines as needing a repaint.
|
void |
invalidateScreenLineRange(int start,
int end)
Marks a range of screen lines as needing a repaint.
|
void |
invertSelection()
Inverts the selection.
|
boolean |
isCaretBlinkEnabled() |
boolean |
isCaretVisible()
Returns true if the caret is visible, false otherwise.
|
boolean |
isCtrlForRectangularSelection()
If set, CTRL enables rectangular selection mode while pressed.
|
boolean |
isDragEnabled()
Returns if drag and drop of text is enabled.
|
boolean |
isEditable()
Returns true if this text area is editable, false otherwise.
|
boolean |
isMultipleSelectionEnabled()
Returns if multiple selection is enabled.
|
boolean |
isOverwriteEnabled()
Returns true if overwrite mode is enabled, false otherwise.
|
boolean |
isQuickCopyEnabled()
Returns if clicking the middle mouse button pastes the most
recent selection (% register), and if Control-dragging inserts
the selection at the caret.
|
boolean |
isRectangularSelectionEnabled()
Returns if rectangular selection is enabled.
|
boolean |
isRightClickPopupEnabled()
Returns if the right click popup menu is enabled.
|
void |
joinLines()
Joins the current and the next line, or joins all lines in
selections.
|
void |
lineComment()
Prepends each line of the selection with the line comment string.
|
boolean |
lineInStructureScope(int line)
Returns if the specified line is contained in the currently
matched structure's scope.
|
void |
moveCaretPosition(int newCaret)
Sets the caret position without deactivating the selection.
|
void |
moveCaretPosition(int newCaret,
boolean doElectricScroll)
Sets the caret position without deactivating the selection.
|
void |
moveCaretPosition(int newCaret,
int scrollMode)
Sets the caret position without deactivating the selection.
|
void |
narrowToFold()
Hides all lines except those in the fold containing the caret.
|
void |
narrowToSelection()
Hides all lines except those in the selection.
|
java.awt.Point |
offsetToXY(int offset)
Converts an offset into a point in the text area painter's
co-ordinate space.
|
java.awt.Point |
offsetToXY(int line,
int offset)
Converts an offset into a point in the text area painter's
co-ordinate space.
|
java.awt.Point |
offsetToXY(int line,
int offset,
java.awt.Point retVal)
Converts a line,offset pair into an x,y (pixel) point relative to the
upper left corner (0,0) of the text area.
|
void |
processKeyEvent(java.awt.event.KeyEvent evt) |
void |
propertiesChanged()
Called by jEdit when necessary.
|
void |
rangeComment()
Adds comment start and end strings to the beginning and end of the
selection.
|
void |
removeCaretListener(javax.swing.event.CaretListener listener)
Removes a caret change listener from this text area.
|
void |
removeFromSelection(int offset)
Deactivates the selection at the specified offset.
|
void |
removeFromSelection(Selection sel)
Deactivates the specified selection.
|
void |
removeLeftOfScrollBar(java.awt.Component comp)
Removes a component from the box left of the vertical scroll bar.
|
void |
removeNotify()
Called by the AWT when this component is removed from it's parent.
|
void |
removeScrollListener(ScrollListener listener)
Removes a scroll listener from this text area.
|
void |
removeStatusListener(StatusListener listener)
Removes a scroll listener from this text area.
|
void |
removeStructureMatcher(StructureMatcher matcher)
Removes a structure matcher.
|
void |
removeTopComponent(java.awt.Component comp)
Removes a component from above the gutter, text area, and vertical scroll bar.
|
void |
removeTrailingWhiteSpace()
Removes trailing whitespace from all lines in the selection.
|
int |
replaceSelection(java.lang.String selectedText)
Set the selection, but does not deactivate it, and does not move the
caret.
|
void |
resizeSelection(int offset,
int end,
int extraEndVirt,
boolean rect)
Resizes the selection at the specified offset, or creates a new
one if there is no selection at the specified offset.
|
void |
scrollAndCenterCaret()
Tries to scroll the textArea so that the caret is centered on the screen.
|
void |
scrollDownLine()
Scrolls down by one line.
|
void |
scrollDownPage()
Scrolls down by one page.
|
void |
scrollTo(int offset,
boolean doElectricScroll)
Ensures that the specified location in the buffer is visible.
|
void |
scrollTo(int line,
int offset,
boolean doElectricScroll)
Ensures that the specified location in the buffer is visible.
|
void |
scrollToCaret(boolean doElectricScroll)
Ensures that the caret is visible by scrolling the text area if
necessary.
|
void |
scrollUpLine()
Scrolls up by one line.
|
void |
scrollUpPage()
Scrolls up by one page.
|
void |
selectAll()
Selects all text in the buffer.
|
void |
selectBlock()
Selects the code block surrounding the caret.
|
void |
selectFold()
Selects the fold that contains the caret line number.
|
void |
selectFold(int line)
Selects the fold that contains the specified line number.
|
void |
selectLine()
Selects the current line.
|
void |
selectNone()
Deselects everything.
|
void |
selectParagraph()
Selects the paragraph at the caret position.
|
void |
selectToMatchingBracket()
Selects from the bracket at the caret position to the corresponding
bracket.
|
Selection |
selectToMatchingBracket(int position,
boolean quickCopy)
Selects from the bracket at the specified position to the
corresponding bracket.
|
void |
selectWord()
Selects the word at the caret position.
|
void |
setBuffer(JEditBuffer buffer)
Sets the buffer this text area is editing.
|
void |
setCaretBlinkEnabled(boolean caretBlinks)
Toggles caret blinking.
|
void |
setCaretPosition(int newCaret)
Sets the caret position and deactivates the selection.
|
void |
setCaretPosition(int newCaret,
boolean doElectricScroll)
Sets the caret position and deactivates the selection.
|
void |
setCtrlForRectangularSelection(boolean ctrlForRectangularSelection)
If set, CTRL enables rectangular selection mode while pressed.
|
void |
setDragEnabled(boolean dndEnabled)
Sets if drag and drop of text is enabled.
|
void |
setElectricScroll(int electricScroll)
Sets the number of lines from the top and bottom of the text
area that are always visible
|
void |
setFirstLine(int firstLine)
Sets the vertical scroll bar position
|
void |
setFirstPhysicalLine(int physFirstLine)
Sets the vertical scroll bar position.
|
void |
setFirstPhysicalLine(int physFirstLine,
int skew)
Sets the vertical scroll bar position.
|
void |
setHorizontalOffset(int horizontalOffset)
Sets the horizontal offset of drawn lines.
|
void |
setJoinNonWordChars(boolean joinNonWordChars)
If set, double clicking will join non-word characters to form one "word".
|
void |
setMagicCaretPosition(int magicCaret)
Sets the `magic' caret position.
|
void |
setMouseHandler(javax.swing.event.MouseInputAdapter mouseInputAdapter) |
void |
setMultipleSelectionEnabled(boolean multi)
Set multiple selection on or off according to the value of
multi . |
void |
setOverwriteEnabled(boolean overwrite)
Sets overwrite mode.
|
void |
setQuickCopyEnabled(boolean quickCopy)
Sets if clicking the middle mouse button pastes the most
recent selection (% register), and if Control-dragging inserts
the selection at the caret.
|
void |
setRectangularSelectionEnabled(boolean rectangularSelectionMode)
Set rectangular selection on or off according to the value of
rectangularSelectionMode . |
void |
setRightClickPopup(javax.swing.JPopupMenu popup)
Sets the right click popup menu.
|
void |
setRightClickPopupEnabled(boolean popupEnabled)
Sets if the right click popup menu is enabled.
|
void |
setSelectedText(Selection s,
java.lang.String selectedText)
Replaces the selection with the specified text.
|
void |
setSelectedText(java.lang.String selectedText)
Replaces the selection at the caret with the specified text.
|
void |
setSelectedText(java.lang.String selectedText,
boolean moveCaret)
Replaces the selection at the caret with the specified text.
|
void |
setSelection(Selection selection)
Sets the selection.
|
void |
setSelection(Selection[] selection)
Sets the selection.
|
void |
setText(java.lang.String text)
Sets the entire text of this text area.
|
void |
setTransferHandler(javax.swing.TransferHandler newHandler) |
void |
shiftIndentLeft()
Shifts the indent to the left.
|
void |
shiftIndentRight()
Shifts the indent to the right.
|
void |
showPopupMenu()
Shows the popup menu below the current caret position.
|
static void |
showPopupMenu(javax.swing.JPopupMenu popup,
java.awt.Component comp,
int x,
int y,
boolean point)
|
void |
smartEnd(boolean select)
Has 4 states based on # of invocations:
1.
|
void |
smartHome(boolean select)
On subsequent invocations, first moves the caret to the first
non-whitespace character of the line, then the beginning of the
line, then to the first visible line.
|
void |
spacesToTabs()
Converts spaces to tabs in the selection.
|
void |
tabsToSpaces()
Converts tabs to spaces in the selection.
|
void |
toggleMultipleSelectionEnabled()
Toggles multiple selection.
|
void |
toggleOverwriteEnabled()
Toggles overwrite mode.
|
void |
toggleRectangularSelectionEnabled()
Toggles rectangular selection.
|
void |
toLowerCase()
Converts the selected text to lower case.
|
java.lang.String |
toString() |
void |
toUpperCase()
Converts the selected text to upper case.
|
void |
turnOnElasticTabstops()
Turn ON elastic tab stops.
|
void |
userInput(char ch)
Handles the insertion of the specified character.
|
protected void |
userInputTab() |
int |
xToScreenLineOffset(int screenLine,
int x,
boolean round)
Converts a point in a given screen line to an offset.
|
int |
xyToOffset(int x,
int y)
Converts a point to an offset.
|
int |
xyToOffset(int x,
int y,
boolean round)
Converts a point to an offset.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, update
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, validateTree
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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int NO_SCROLL
public static final int NORMAL_SCROLL
public static final int ELECTRIC_SCROLL
protected javax.swing.JPopupMenu popup
protected final TextAreaPainter painter
protected InputHandlerProvider inputHandlerProvider
protected JEditBuffer buffer
protected int caret
protected int caretLine
protected boolean multi
protected TextArea(IPropertyManager propertyManager, InputHandlerProvider inputHandlerProvider)
propertyManager
- the property manager that contains informations like shortcut bindingsinputHandlerProvider
- the inputHandlerProviderpublic FoldPainter getFoldPainter()
public void initInputHandler()
public JEditActionContext<JEditBeanShellAction,JEditActionSet<JEditBeanShellAction>> getActionContext()
public void setMouseHandler(javax.swing.event.MouseInputAdapter mouseInputAdapter)
public void setTransferHandler(javax.swing.TransferHandler newHandler)
setTransferHandler
in class javax.swing.JComponent
public java.lang.String toString()
toString
in class java.awt.Component
public void dispose()
public AbstractInputHandler getInputHandler()
public final TextAreaPainter getPainter()
public final Gutter getGutter()
public DisplayManager getDisplayManager()
public final boolean isCaretBlinkEnabled()
public void setCaretBlinkEnabled(boolean caretBlinks)
caretBlinks
- True if the caret should blink, false otherwisepublic final int getElectricScroll()
public final void setElectricScroll(int electricScroll)
electricScroll
- The number of lines always visible from
the top or bottompublic final boolean isQuickCopyEnabled()
public final void setQuickCopyEnabled(boolean quickCopy)
quickCopy
- A boolean flagpublic final JEditBuffer getBuffer()
public void setBuffer(JEditBuffer buffer)
EditPane.setBuffer(org.gjt.sp.jedit.Buffer)
instead.buffer
- The bufferpublic final boolean isEditable()
public boolean isDragEnabled()
public void setDragEnabled(boolean dndEnabled)
public boolean getJoinNonWordChars()
public void setJoinNonWordChars(boolean joinNonWordChars)
public boolean isCtrlForRectangularSelection()
public void setCtrlForRectangularSelection(boolean ctrlForRectangularSelection)
public final int getFirstLine()
public void setFirstLine(int firstLine)
firstLine
- The scroll bar positionpublic final int getFirstPhysicalLine()
public void setFirstPhysicalLine(int physFirstLine)
physFirstLine
- The first physical line to displaypublic void setFirstPhysicalLine(int physFirstLine, int skew)
physFirstLine
- The first physical line to displayskew
- A local screen line deltapublic final int getLastPhysicalLine()
public int getLastScreenLine()
getVisibleLines()
because the buffer can have less lines than
the visible linespublic final int getVisibleLines()
public final int getHorizontalOffset()
public void setHorizontalOffset(int horizontalOffset)
horizontalOffset
- offset The new horizontal offsetpublic void scrollUpLine()
public void scrollUpPage()
public void scrollDownLine()
public void scrollDownPage()
public void scrollToCaret(boolean doElectricScroll)
doElectricScroll
- If true, electric scrolling will be performedpublic void scrollTo(int offset, boolean doElectricScroll)
offset
- The offset from the start of the bufferdoElectricScroll
- If true, electric scrolling will be performedpublic void scrollTo(int line, int offset, boolean doElectricScroll)
line
- The line numberoffset
- The offset from the start of the linedoElectricScroll
- If true, electric scrolling will be performedpublic final void addScrollListener(ScrollListener listener)
listener
- The listenerpublic final void removeScrollListener(ScrollListener listener)
listener
- The listenerpublic int getPhysicalLineOfScreenLine(int screenLine)
screenLine
- The screen linepublic int getScreenLineOfOffset(int offset)
offset
- The offsetpublic int getScreenLineStartOffset(int line)
line
- The linepublic int getScreenLineEndOffset(int line)
line
- The linepublic int xyToOffset(int x, int y)
x
- The x co-ordinate of the pointy
- The y co-ordinate of the pointpublic int xyToOffset(int x, int y, boolean round)
x
- The x co-ordinate of the pointy
- The y co-ordinate of the pointround
- Round up to next character if past the middle of a character?public int xToScreenLineOffset(int screenLine, int x, boolean round)
x
- The x co-ordinate of the pointscreenLine
- The screen lineround
- Round up to next character if past the middle of a character?public java.awt.Point offsetToXY(int offset)
offset
- The offsetnull
if the specified offset is not visiblepublic java.awt.Point offsetToXY(int line, int offset)
line
- The lineoffset
- The offsetnull
if the specified offset is not visiblepublic java.awt.Point offsetToXY(int line, int offset, java.awt.Point retVal)
line
- The physical line number (from top of document)offset
- The offset in characters, from the start of the lineretVal
- The point to store the return value inretVal
for convenience, or null
if the specified offset is not visiblepublic void invalidateScreenLineRange(int start, int end)
start
- The first lineend
- The last linepublic void invalidateLine(int line)
line
- The physical line to invalidatepublic void invalidateLineRange(int start, int end)
start
- The first line to invalidateend
- The last line to invalidatepublic final int getBufferLength()
public final int getLineCount()
public final int getLineOfOffset(int offset)
offset
- The offsetpublic int getLineStartOffset(int line)
line
- The line (physical line)public int getLineEndOffset(int line)
line
- The line (physical line)public int getLineLength(int line)
line
- The linepublic final java.lang.String getText(int start, int len)
start
- The start offsetlen
- The length of the substringpublic final void getText(int start, int len, javax.swing.text.Segment segment)
start
- The start offsetlen
- The length of the substringsegment
- The segmentpublic java.lang.String getText()
public final java.lang.String getLineText(int lineIndex)
lineIndex
- the line numberpublic final void getLineText(int lineIndex, javax.swing.text.Segment segment)
lineIndex
- The line number (physical line)segment
- the segment into which the data will be stored.public java.lang.String getVisibleLineText(int screenLine)
screenLine
- the screenLinepublic void getVisibleLineText(int screenLine, javax.swing.text.Segment segment)
screenLine
- the screenLinesegment
- the segment into which the data will be stored.public java.lang.CharSequence getVisibleLineSegment(int screenLine)
screenLine
- the screenLinepublic void setText(java.lang.String text)
text
- the new content of the bufferpublic final void selectAll()
public void selectLine()
public void selectParagraph()
public void selectWord()
public Selection selectToMatchingBracket(int position, boolean quickCopy)
public void selectToMatchingBracket()
public void selectBlock()
public boolean lineInStructureScope(int line)
public final void invertSelection()
public int getSelectionCount()
@Nonnull public Selection[] getSelection()
public Selection getSelection(int index)
getSelectionCount()
.index
- the index of the selection you wantpublic java.util.Iterator<Selection> getSelectionIterator()
public void selectNone()
public void setSelection(Selection[] selection)
selection
- The new selection
since jEdit 3.2pre1public void setSelection(Selection selection)
selection
- The new selection
since jEdit 3.2pre1public void addToSelection(Selection[] selection)
selection
- The new selection
since jEdit 3.2pre1public void addToSelection(Selection selection)
selection
- The new selection
since jEdit 3.2pre1public Selection getSelectionAtOffset(int offset)
null
if there is no selection at that offset.offset
- The offsetpublic void removeFromSelection(Selection sel)
sel
- The selectionpublic void removeFromSelection(int offset)
offset
- The offsetpublic void resizeSelection(int offset, int end, int extraEndVirt, boolean rect)
offset
- The offsetend
- The new selection endextraEndVirt
- Only for rectangular selections - specifies how
far it extends into virtual space.rect
- Make the selection rectangular?public void extendSelection(int offset, int end)
offset
- The offsetend
- The new selection endpublic void extendSelection(int offset, int end, int extraStartVirt, int extraEndVirt)
offset
- The offsetend
- The new selection endextraStartVirt
- Extra virtual space at the startextraEndVirt
- Extra virtual space at the endpublic java.lang.String getSelectedText(Selection s)
s
- The selectionpublic java.lang.String getSelectedText(java.lang.String separator)
separator
- The string to insert between each text chunk
(for example, a newline)public java.lang.String getSelectedText()
public void setSelectedText(Selection s, java.lang.String selectedText)
s
- The selectionselectedText
- The new textpublic void setSelectedText(java.lang.String selectedText)
public void setSelectedText(java.lang.String selectedText, boolean moveCaret)
selectedText
- The new selectionmoveCaret
- Move caret to insertion location if necessarypublic int replaceSelection(java.lang.String selectedText)
setSelectedText(String)
instead.selectedText
- The new selectionpublic int[] getSelectedLines()
This method is the most convenient way to iterate through selected
lines in a buffer. The line numbers in the array returned by this
method can be passed as a parameter to such methods as
JEditBuffer.getLineText(int)
.
public boolean caretAutoScroll()
public void addStructureMatcher(StructureMatcher matcher)
public void removeStructureMatcher(StructureMatcher matcher)
public StructureMatcher.Match getStructureMatch()
public final void blinkCaret()
public void centerCaret()
public void scrollAndCenterCaret()
public void setCaretPosition(int newCaret)
newCaret
- The caret positionpublic void setCaretPosition(int newCaret, boolean doElectricScroll)
newCaret
- The caret positiondoElectricScroll
- Do electric scrolling?public void moveCaretPosition(int newCaret)
newCaret
- The caret positionpublic void moveCaretPosition(int newCaret, boolean doElectricScroll)
newCaret
- The caret positiondoElectricScroll
- Do electric scrolling?public void moveCaretPosition(int newCaret, int scrollMode)
newCaret
- The caret positionscrollMode
- The scroll mode (NO_SCROLL, NORMAL_SCROLL, or
ELECTRIC_SCROLL).public int getCaretPosition()
public int getCaretLine()
public int getMagicCaretPosition()
public void setMagicCaretPosition(int magicCaret)
magicCaret
- The magic caret positionpublic final void addCaretListener(javax.swing.event.CaretListener listener)
listener
- The listenerpublic final void removeCaretListener(javax.swing.event.CaretListener listener)
listener
- The listenerpublic void goToNextBracket(boolean select)
select
- true if you want to extend selectionpublic void goToNextCharacter(boolean select)
select
- true if you want to extend selectionpublic void goToNextLine(boolean select)
select
- true if you want to extend selectionpublic void goToNextPage(boolean select)
select
- true if you want to extend selectionpublic void goToNextParagraph(boolean select)
select
- true if you want to extend selectionpublic void goToNextWord(boolean select)
select
- true if you want to extend selectionpublic void goToNextWord(boolean select, boolean eatWhitespace)
public void goToPrevBracket(boolean select)
select
- true if you want to extend selectionpublic void goToPrevCharacter(boolean select)
select
- true if you want to extend selectionpublic void goToPrevLine(boolean select)
select
- true if you want to extend selectionpublic void goToPrevPage(boolean select)
select
- true if you want to extend selectionpublic void goToPrevParagraph(boolean select)
select
- true if you want to extend selectionpublic void goToPrevWord(boolean select)
select
- true if you want to extend selectionpublic void goToPrevWord(boolean select, boolean eatWhitespace)
eatWhitespace
- If true, will eat whitespacepublic void goToPrevWord(boolean select, boolean eatWhitespace, boolean eatOnlyAfterWord)
eatWhitespace
- If true, will eat whitespaceeatOnlyAfterWord
- Eat only whitespace after a word,
in effect this goes to actual word starts even if eatingpublic void home(boolean select)
select
- true if we also want to select from the cursorpublic void end(boolean select)
select
- true if we also want to select from the cursorpublic void smartHome(boolean select)
select
- true if you want to extend selectionpublic void smartEnd(boolean select)
select
- true if you want to extend selectionpublic void goToStartOfLine(boolean select)
select
- true if you want to extend selectionpublic void goToEndOfLine(boolean select)
select
- true if you want to extend selectionpublic void goToEndOfCode(boolean select)
select
- true if you want to extend selectionpublic void goToStartOfWhiteSpace(boolean select)
select
- true if you want to extend selectionpublic void goToEndOfWhiteSpace(boolean select)
select
- true if you want to extend selectionpublic void goToFirstVisibleLine(boolean select)
select
- true if you want to extend selectionpublic void goToLastVisibleLine(boolean select)
select
- true if you want to extend selectionpublic void goToBufferStart(boolean select)
select
- true if you want to extend selectionpublic void goToBufferEnd(boolean select)
select
- true if you want to extend selectionpublic void goToMatchingBracket()
public void userInput(char ch)
ch
- The charactersetSelectedText(String)
,
isOverwriteEnabled()
public final boolean isOverwriteEnabled()
public final void setOverwriteEnabled(boolean overwrite)
public final void toggleOverwriteEnabled()
public void backspace()
public void backspaceWord()
public void backspaceWord(boolean eatWhitespace)
eatWhitespace
- If true, will eat whitespacepublic void backspaceWord(boolean eatWhitespace, boolean eatOnlyAfterWord)
eatWhitespace
- If true, will eat whitespaceeatOnlyAfterWord
- Eat only whitespace after a word,
in effect this goes to actual word starts even if eatingpublic void delete()
public void deleteToEndOfLine()
public void deleteLine()
public void deleteParagraph()
public void deleteToStartOfLine()
public void deleteWord()
public void deleteWord(boolean eatWhitespace)
public final boolean isMultipleSelectionEnabled()
public final void toggleMultipleSelectionEnabled()
public final void setMultipleSelectionEnabled(boolean multi)
multi
. This only affects the ability to
make multiple selections in the user interface; macros and plugins
can manipulate them regardless of the setting of this flag. In fact,
in most cases, calling this method should not be necessary.multi
- Should multiple selection be enabled?public final boolean isRectangularSelectionEnabled()
public final void toggleRectangularSelectionEnabled()
public final void setRectangularSelectionEnabled(boolean rectangularSelectionMode)
rectangularSelectionMode
. This only affects the ability
to make multiple selections from the keyboard. A rectangular
selection can always be created by dragging with the mouse by holding
down Control, regardless of the state of this flag.rectangularSelectionMode
- Should rectangular selection be
enabled?public void goToParentFold()
public void goToNextFold(boolean select)
select
- true if you want to extend selectionpublic void goToPrevFold(boolean select)
select
- true if you want to extend selectionpublic void collapseFold()
DisplayManager.collapseFold(int)
, but
also moves the caret to the first line of the fold.public void collapseFold(int line)
DisplayManager.collapseFold(int)
, but
also moves the caret to the first line of the fold.line
- the physical line index of the fold that we want to collapsepublic void expandFold(boolean fully)
DisplayManager.expandFold(int,boolean)
, but
also moves the caret to the first sub-fold.fully
- If true, all subfolds will also be expandedpublic void selectFold()
public void selectFold(int line)
line
- The line numberpublic void narrowToFold()
public void narrowToSelection()
public void addExplicitFold() throws TextAreaException
TextAreaException
- an exception thrown if the folding mode is
not explicitpublic void lineComment()
public void rangeComment()
public void formatParagraph() throws TextAreaException
TextAreaException
public void spacesToTabs()
public void tabsToSpaces()
public void toUpperCase()
public void toLowerCase()
public void removeTrailingWhiteSpace()
public void insertEnterAndIndent()
public void insertTabAndIndent()
public void indentSelectedLines()
public void turnOnElasticTabstops()
public void shiftIndentLeft()
public void shiftIndentRight()
public void joinLines()
public void addLeftOfScrollBar(java.awt.Component comp)
comp
- The componentpublic void removeLeftOfScrollBar(java.awt.Component comp)
comp
- The componentpublic void addNotify()
addNotify
in class javax.swing.JComponent
public void removeNotify()
removeNotify
in class javax.swing.JComponent
public boolean getFocusTraversalKeysEnabled()
getFocusTraversalKeysEnabled
in class java.awt.Component
public boolean getFocusCycleRoot()
public void processKeyEvent(java.awt.event.KeyEvent evt)
processKeyEvent
in class javax.swing.JComponent
public void addTopComponent(java.awt.Component comp)
public void removeTopComponent(java.awt.Component comp)
public void addTopLeftComponent(java.awt.Component comp)
public void addTopRightComponent(java.awt.Component comp)
public void addBottomLeftComponent(java.awt.Component comp)
public void addBottomRightComponent(java.awt.Component comp)
public java.awt.im.InputMethodRequests getInputMethodRequests()
getInputMethodRequests
in class java.awt.Component
public final void addStatusListener(StatusListener listener)
listener
- The listenerpublic final void removeStatusListener(StatusListener listener)
listener
- The listenerpublic void propertiesChanged()
public void addActionSet(JEditActionSet<JEditBeanShellAction> actionSet)
actionSet
- the actionSet to add@Deprecated public final int getMarkPosition()
public final boolean isCaretVisible()
protected void insert(java.lang.String str, boolean indent)
protected void userInputTab()
protected boolean doWordWrap(boolean spaceInserted)
protected int addExplicitFold(int caretStart, int caretEnd, int lineStart, int lineEnd)
caretStart
- the starting offsetcaretEnd
- the end offsetlineStart
- the start linelineEnd
- the end linepublic boolean isRightClickPopupEnabled()
public void setRightClickPopupEnabled(boolean popupEnabled)
public final javax.swing.JPopupMenu getRightClickPopup()
public final void setRightClickPopup(javax.swing.JPopupMenu popup)
popup
- The popuppublic void handlePopupTrigger(java.awt.event.MouseEvent evt)
public void createPopupMenu(java.awt.event.MouseEvent evt)
setRightClickPopupEnabled(boolean)
to enable the
popup menupublic void showPopupMenu()
public static void showPopupMenu(javax.swing.JPopupMenu popup, java.awt.Component comp, int x, int y, boolean point)
popup
- The popup menucomp
- The component to show it forx
- The x co-ordinatey
- The y co-ordinatepoint
- If true, then the popup originates from a single point;
otherwise it will originate from the component itself. This affects
positioning in the case where the popup does not fit onscreen.
FIXME: move parts of GUIUtilities compatible with standalone TextArea in a separate
class, to prevent such copiespublic javax.swing.text.TabExpander getTabExpander()