Gridarta Editor
net.sf.gridarta.textedit.textarea.JEditTextArea Class Reference

jEdit's text area component. More...

+ Inheritance diagram for net.sf.gridarta.textedit.textarea.JEditTextArea:
+ Collaboration diagram for net.sf.gridarta.textedit.textarea.JEditTextArea:

Classes

class  AdjustHandler
 
class  CaretBlinker
 
class  CaretUndo
 
class  ComponentHandler
 
class  DocumentHandler
 
class  DragHandler
 
class  FocusHandler
 
class  MouseHandler
 RefusedBequest More...
 

Public Member Functions

void blinkCaret ()
 Blinks the caret. More...
 
void copy ()
 Places the selected text into the clipboard. More...
 
void cut ()
 Deletes the selected text from the text area and places it into the clipboard. More...
 
int getCaretLine ()
 Returns the caret line. More...
 
int getCaretPosition ()
 Returns the caret position. More...
 
Document getDocument ()
 Returns the document this text area is editing. More...
 
int getDocumentLength ()
 Returns the length of the document. More...
 
int getElectricScroll ()
 Returns the number of lines from the top and button of the text area that are always visible. More...
 
int getFirstLine ()
 Returns the line displayed at the text area's origin. More...
 
InputHandler getInputHandler ()
 Returns the input handler. More...
 
int getLineCount ()
 Returns the number of lines in the document. More...
 
int getLineEndOffset (final int line)
 Returns the end offset of the specified line. More...
 
int getLineStartOffset (final int line)
 Returns the start offset of the specified line. More...
 
CharSequence getLineText (final int lineIndex)
 Returns the text on the specified line. More...
 
int getMagicCaretPosition ()
 Returns the `magic' caret position. More...
 
int getMarkPosition ()
 Returns the mark position. More...
 
String getSelectedText ()
 Returns the selected text, or null if no selection is active. More...
 
int getSelectionEnd ()
 Returns the selection end offset. More...
 
int getSelectionStart ()
 Returns the selection start offset. More...
 
String getText ()
 Returns the entire text of this text area. More...
 
String getText (final int start, final int len)
 Returns the specified substring of the document. More...
 
void getText (final int start, final int len, @NotNull final Segment segment)
 Copies the specified substring of the document into a segment. More...
 
int getVisibleLines ()
 Returns the number of lines visible in this text area. More...
 
boolean isEditable ()
 Returns true if this text area is editable, false otherwise. More...
 
boolean isModified ()
 Return whether the text content has been modified from the "unmodified" state. More...
 
boolean isOverwriteEnabled ()
 Returns whether overwrite mode is active. More...
 
boolean isSelectionRectangular ()
 Returns true if the selection is rectangular, false otherwise. More...
 
 JEditTextArea (@NotNull final TextAreaDefaults defaults, @NotNull final SyntaxDocument document, final boolean paintInvalid)
 Creates a new JEditTextArea with the specified settings. More...
 
int lineToY (final int line)
 Converts a line index to a y co-ordinate. More...
 
int offsetToX (final int line, final int offset)
 Converts an offset in a line into an x co-ordinate. More...
 
int offsetToX2 (final int line, final int offset)
 Converts an offset in a line into an x co-ordinate. More...
 
void overwriteSetSelectedText (@NotNull final String str)
 Similar to. More...
 
void paste ()
 Inserts the clipboard contents into the text. More...
 
void processKeyEvent (@NotNull final KeyEvent e)
 Forwards key events directly to the input handler. More...
 
void removeNotify ()
 Called by the AWT when this component is removed from it's parent. More...
 
void resetModified ()
 Reset the "modified" state. More...
 
void scrollTo (final int line, final int offset)
 Ensures that the specified line and offset is visible by scrolling the text area if necessary. More...
 
void scrollToCaret ()
 Ensures that the caret is visible by scrolling the text area if necessary. More...
 
void select (final int start, final int end)
 Selects from the start offset to the end offset. More...
 
void selectAll ()
 Selects all text in the document. More...
 
void setCaretPosition (final int caret)
 Sets the caret position. More...
 
void setCaretVisible (final boolean caretVisible)
 Sets if the caret should be visible. More...
 
void setEditingFocus ()
 Sets the focus to this TextArea, so this component is instantly registered for key press events. More...
 
void setFirstLine (final int firstLine)
 Sets the line displayed at the text area's origin without updating the scroll bars. More...
 
void setFont (@NotNull final Font font)
 Set the TextArea font. More...
 
void setHorizontalOffset (final int horizontalOffset)
 Sets the horizontal offset of drawn lines. More...
 
void setMagicCaretPosition (final int magicCaret)
 Sets the `magic' caret position. More...
 
void setOrigin (final int firstLine, final int horizontalOffset)
 A fast way of changing both the first line and horizontal offset. More...
 
void setOverwriteEnabled (final boolean overwrite)
 Sets whether overwrite mode is active. More...
 
void setSelectedText (@NotNull final String selectedText)
 Replaces the selection with the specified text. More...
 
void setSelectionRectangular (final boolean rectangleSelect)
 Sets if the selection should be rectangular. More...
 
void setText (@NotNull final String text)
 Sets the entire text of this text area. More...
 
void updateScrollBars ()
 Updates the state of the scroll bars. More...
 
int xToOffset (final int line, final int x)
 Converts an x co-ordinate to an offset within a line. More...
 

Private Member Functions

void documentChanged (@NotNull final DocumentEvent evt)
 
void freeTabKeyFromFocusTraversal ()
 In JDKs above 1.4, the tab key is used for focus traversal. More...
 
void updateBracketHighlight (final int newCaretPosition)
 

Private Attributes

final TextAreaBrackets brackets = new TextAreaBrackets()
 
final TextAreaCaret caret
 
final TextAreaConfig config
 The TextAreaConfig for this instance. More...
 
final SyntaxDocument document
 
final JScrollBar horizontal = new JScrollBar(Adjustable.HORIZONTAL)
 
final InputHandler inputHandler
 
final TextAreaPainter painter
 
final JPopupMenu popup
 
boolean scrollBarsInitialized
 
final TextAreaSelection selection
 
String unmodifiedText = ""
 The text contents in the last "unmodified" state. More...
 
final JScrollBar vertical = new JScrollBar(Adjustable.VERTICAL)
 

Static Private Attributes

static final Timer CARET_TIMER = new Timer(500, new CaretBlinker())
 
static JEditTextArea focusedComponent
 
static final Category LOG = Logger.getLogger(JEditTextArea.class)
 The Logger for printing log messages. More...
 
static final long serialVersionUID = 1L
 Serial Version UID. More...
 

Detailed Description

jEdit's text area component.

It is more suited for editing program source code than JEditorPane, because it drops the unnecessary features (images, variable-width lines, and so on) and adds a whole bunch of useful goodies such as:

  • More flexible key binding scheme
  • Supports macro recorders
  • Rectangular selection
  • Bracket highlighting
  • Syntax highlighting
  • Command repetition
  • Block caret can be enabled

It is also faster and doesn't have as many problems. It can be used in other applications; the only other part of jEdit it depends on is the syntax package.

To use it in your app, treat it like any other component, for example:

JEditTextArea ta = new JEditTextArea();
ta.setTokenMarker(new JavaTokenMarker());
ta.setText("public class Test {\n"
    + "    public static void main(String[] args) {\n"
    + "        System.err.println(\"Hello World");
" + " }
" + "}");
Author
Slava Pestov
Andreas Vogl
Andreas Kirschbaum

Definition at line 90 of file JEditTextArea.java.

Constructor & Destructor Documentation

◆ JEditTextArea()

net.sf.gridarta.textedit.textarea.JEditTextArea.JEditTextArea ( @NotNull final TextAreaDefaults  defaults,
@NotNull final SyntaxDocument  document,
final boolean  paintInvalid 
)

Member Function Documentation

◆ blinkCaret()

void net.sf.gridarta.textedit.textarea.JEditTextArea.blinkCaret ( )

Blinks the caret.

Definition at line 285 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaCaret.blinkCaret(), and net.sf.gridarta.textedit.textarea.TextAreaPainter.invalidateSelectedLines().

Referenced by net.sf.gridarta.textedit.textarea.JEditTextArea.CaretBlinker.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy()

void net.sf.gridarta.textedit.textarea.JEditTextArea.copy ( )

◆ cut()

void net.sf.gridarta.textedit.textarea.JEditTextArea.cut ( )

Deletes the selected text from the text area and places it into the clipboard.

Definition at line 829 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.JEditTextArea.copy(), net.sf.gridarta.textedit.textarea.TextAreaConfig.isEditable(), and net.sf.gridarta.textedit.textarea.JEditTextArea.setSelectedText().

+ Here is the call graph for this function:

◆ documentChanged()

◆ freeTabKeyFromFocusTraversal()

void net.sf.gridarta.textedit.textarea.JEditTextArea.freeTabKeyFromFocusTraversal ( )
private

In JDKs above 1.4, the tab key is used for focus traversal.

That means the tab key normally does not "work" inside the text area. But that would be a pity, because we need the tab key for indentation.

So what this method does is setting the focus traversal to "tab + <control>", in order to "free" the tab key from focus traversal events. In JDKs above 1.4, this task can be accomplished simply by three lines of code:

Set forwardTraversalKeys = new HashSet();
forwardTraversalKeys.add(KeyStroke.getKeyStroke("control TAB"));
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
forwardTraversalKeys);

Now, what's the big deal there? The problem is that the class "KeyboardFocusManager" as well as the method "setFocusTraversalKeys" are undefined in JDKs 1.3.* and below. Hence, if above code was inserted as-is, this application would no longer compile with java 1.3.

The solution to this problem is implemented here: The critical classes and methods are accessed through the reflection interface, which allows to execute them if defined but still compile if undefined.

Definition at line 228 of file JEditTextArea.java.

Referenced by net.sf.gridarta.textedit.textarea.JEditTextArea.JEditTextArea().

+ Here is the caller graph for this function:

◆ getCaretLine()

◆ getCaretPosition()

◆ getDocument()

◆ getDocumentLength()

◆ getElectricScroll()

int net.sf.gridarta.textedit.textarea.JEditTextArea.getElectricScroll ( )

Returns the number of lines from the top and button of the text area that are always visible.

Definition at line 295 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaConfig.getElectricScroll().

Referenced by net.sf.gridarta.textedit.textarea.actions.End.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.Home.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstLine()

int net.sf.gridarta.textedit.textarea.JEditTextArea.getFirstLine ( )

◆ getInputHandler()

InputHandler net.sf.gridarta.textedit.textarea.JEditTextArea.getInputHandler ( )

◆ getLineCount()

int net.sf.gridarta.textedit.textarea.JEditTextArea.getLineCount ( )

Returns the number of lines in the document.

Definition at line 520 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.getLineCount().

Referenced by net.sf.gridarta.textedit.textarea.actions.End.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextPage.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.NextLine.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLineEndOffset()

int net.sf.gridarta.textedit.textarea.JEditTextArea.getLineEndOffset ( final int  line)

Returns the end offset of the specified line.

Parameters
linethe line
Returns
the end offset of the specified line, or -1 if the line is invalid

Definition at line 540 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.getLineEndOffset().

Referenced by net.sf.gridarta.textedit.textarea.actions.End.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLineStartOffset()

◆ getLineText()

CharSequence net.sf.gridarta.textedit.textarea.JEditTextArea.getLineText ( final int  lineIndex)

Returns the text on the specified line.

Parameters
lineIndexthe line
Returns
the text, or null if the line is invalid

Definition at line 587 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.getLineText().

Referenced by net.sf.gridarta.textedit.textarea.actions.BackspaceWord.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.DeleteWord.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextWord.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.PrevWord.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMagicCaretPosition()

int net.sf.gridarta.textedit.textarea.JEditTextArea.getMagicCaretPosition ( )

Returns the `magic' caret position.

This can be used to preserve the column position when moving up and down lines.

Definition at line 743 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaConfig.getMagicCaret().

Referenced by net.sf.gridarta.textedit.textarea.actions.NextLine.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.PrevLine.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMarkPosition()

◆ getSelectedText()

◆ getSelectionEnd()

int net.sf.gridarta.textedit.textarea.JEditTextArea.getSelectionEnd ( )

◆ getSelectionStart()

int net.sf.gridarta.textedit.textarea.JEditTextArea.getSelectionStart ( )

◆ getText() [1/3]

◆ getText() [2/3]

String net.sf.gridarta.textedit.textarea.JEditTextArea.getText ( final int  start,
final int  len 
)

Returns the specified substring of the document.

Parameters
startthe start offset
lenthe length of the substring
Returns
the substring, or null if the offsets are invalid

Definition at line 566 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.getText().

+ Here is the call graph for this function:

◆ getText() [3/3]

void net.sf.gridarta.textedit.textarea.JEditTextArea.getText ( final int  start,
final int  len,
@NotNull final Segment  segment 
)

Copies the specified substring of the document into a segment.

If the offsets are invalid, the segment will contain a null string.

Parameters
startthe start offset
lenthe length of the substring
segmentthe segment

Definition at line 577 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.getText().

+ Here is the call graph for this function:

◆ getVisibleLines()

◆ isEditable()

boolean net.sf.gridarta.textedit.textarea.JEditTextArea.isEditable ( )

◆ isModified()

boolean net.sf.gridarta.textedit.textarea.JEditTextArea.isModified ( )

Return whether the text content has been modified from the "unmodified" state.

Returns
true
if the text content has been modified, or
false
if it is unmodified

Definition at line 970 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.getText().

Referenced by net.sf.gridarta.textedit.scripteditor.ScriptEditControl.closeActiveTab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOverwriteEnabled()

boolean net.sf.gridarta.textedit.textarea.JEditTextArea.isOverwriteEnabled ( )

Returns whether overwrite mode is active.

Returns
whether overwrite mode is active

Definition at line 795 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaConfig.isOverwrite().

Referenced by net.sf.gridarta.textedit.textarea.actions.Overwrite.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSelectionRectangular()

boolean net.sf.gridarta.textedit.textarea.JEditTextArea.isSelectionRectangular ( )

Returns true if the selection is rectangular, false otherwise.

Definition at line 811 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.isSelectionRectangular().

Referenced by net.sf.gridarta.textedit.textarea.actions.ToggleRectangle.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lineToY()

int net.sf.gridarta.textedit.textarea.JEditTextArea.lineToY ( final int  line)

Converts a line index to a y co-ordinate.

Parameters
linethe line

Definition at line 467 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.lineToY().

Referenced by net.sf.gridarta.textedit.textarea.actions.FunctionMenu.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetToX()

int net.sf.gridarta.textedit.textarea.JEditTextArea.offsetToX ( final int  line,
final int  offset 
)

Converts an offset in a line into an x co-ordinate.

This is a slow version that can be used any time.

Parameters
linethe line
offsetthe offset, from the start of the line

Definition at line 477 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.offsetToX().

Referenced by net.sf.gridarta.textedit.textarea.actions.NextLine.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.PrevLine.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetToX2()

int net.sf.gridarta.textedit.textarea.JEditTextArea.offsetToX2 ( final int  line,
final int  offset 
)

Converts an offset in a line into an x co-ordinate.

This is a fast version that should only be used if no changes were made to the text since the last repaint.

Parameters
linethe line
offsetthe offset, from the start of the line

Definition at line 488 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.offsetToX2().

Referenced by net.sf.gridarta.textedit.textarea.actions.FunctionMenu.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ overwriteSetSelectedText()

◆ paste()

void net.sf.gridarta.textedit.textarea.JEditTextArea.paste ( )

Inserts the clipboard contents into the text.

Definition at line 858 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.InputHandler.getRepeatCount(), net.sf.gridarta.textedit.textarea.TextAreaConfig.isEditable(), and net.sf.gridarta.textedit.textarea.JEditTextArea.setSelectedText().

+ Here is the call graph for this function:

◆ processKeyEvent()

void net.sf.gridarta.textedit.textarea.JEditTextArea.processKeyEvent ( @NotNull final KeyEvent  e)

Forwards key events directly to the input handler.

This is slightly faster than using a KeyListener because some Swing overhead is avoided.

Definition at line 899 of file JEditTextArea.java.

◆ removeNotify()

void net.sf.gridarta.textedit.textarea.JEditTextArea.removeNotify ( )

Called by the AWT when this component is removed from it's parent.

This stops clears the currently focused component.

Definition at line 887 of file JEditTextArea.java.

◆ resetModified()

void net.sf.gridarta.textedit.textarea.JEditTextArea.resetModified ( )

◆ scrollTo()

void net.sf.gridarta.textedit.textarea.JEditTextArea.scrollTo ( final int  line,
final int  offset 
)

◆ scrollToCaret()

void net.sf.gridarta.textedit.textarea.JEditTextArea.scrollToCaret ( )

◆ select()

void net.sf.gridarta.textedit.textarea.JEditTextArea.select ( final int  start,
final int  end 
)

Selects from the start offset to the end offset.

This is the general selection method used by all other selecting methods. The caret position will be start if start < end, and end if end > start.

Parameters
startthe start offset
endthe end offset

Definition at line 654 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.SyntaxDocument.addUndoableEdit(), net.sf.gridarta.textedit.textarea.TextAreaSelection.disableSelectionIfEmpty(), net.sf.gridarta.textedit.textarea.TextAreaSelection.getBiasLeft(), net.sf.gridarta.textedit.textarea.TextAreaBrackets.getBracketLine(), net.sf.gridarta.textedit.textarea.JEditTextArea.getDocumentLength(), net.sf.gridarta.textedit.textarea.TextAreaSelection.getLineOfOffset(), net.sf.gridarta.textedit.textarea.TextAreaSelection.getSelectionEnd(), net.sf.gridarta.textedit.textarea.TextAreaSelection.getSelectionEndLine(), net.sf.gridarta.textedit.textarea.TextAreaSelection.getSelectionStart(), net.sf.gridarta.textedit.textarea.TextAreaSelection.getSelectionStartLine(), net.sf.gridarta.textedit.textarea.TextAreaPainter.invalidateLine(), net.sf.gridarta.textedit.textarea.TextAreaPainter.invalidateLineRange(), net.sf.gridarta.textedit.textarea.TextAreaPainter.isBracketHighlightEnabled(), net.sf.gridarta.textedit.textarea.JEditTextArea.scrollToCaret(), net.sf.gridarta.textedit.textarea.TextAreaCaret.setBlink(), net.sf.gridarta.textedit.textarea.TextAreaConfig.setMagicCaret(), net.sf.gridarta.textedit.textarea.TextAreaSelection.setSelection(), and net.sf.gridarta.textedit.textarea.JEditTextArea.updateBracketHighlight().

Referenced by net.sf.gridarta.textedit.textarea.actions.DocumentEnd.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.DocumentHome.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Home.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevChar.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextChar.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevLine.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevPage.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.End.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextLine.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextPage.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextWord.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevWord.actionPerformed(), net.sf.gridarta.textedit.textarea.JEditTextArea.MouseHandler.doDoubleClick(), net.sf.gridarta.textedit.textarea.JEditTextArea.MouseHandler.doSingleClick(), net.sf.gridarta.textedit.textarea.JEditTextArea.MouseHandler.doTripleClick(), net.sf.gridarta.textedit.textarea.JEditTextArea.DocumentHandler.insertUpdate(), net.sf.gridarta.textedit.textarea.JEditTextArea.JEditTextArea(), net.sf.gridarta.textedit.textarea.JEditTextArea.DragHandler.mouseDragged(), net.sf.gridarta.textedit.textarea.JEditTextArea.CaretUndo.redo(), net.sf.gridarta.textedit.textarea.JEditTextArea.DocumentHandler.removeUpdate(), net.sf.gridarta.textedit.textarea.JEditTextArea.selectAll(), net.sf.gridarta.textedit.textarea.JEditTextArea.setCaretPosition(), and net.sf.gridarta.textedit.textarea.JEditTextArea.CaretUndo.undo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectAll()

void net.sf.gridarta.textedit.textarea.JEditTextArea.selectAll ( )

Selects all text in the document.

Definition at line 643 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.JEditTextArea.getDocumentLength(), and net.sf.gridarta.textedit.textarea.JEditTextArea.select().

+ Here is the call graph for this function:

◆ setCaretPosition()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setCaretPosition ( final int  caret)

◆ setCaretVisible()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setCaretVisible ( final boolean  caretVisible)

◆ setEditingFocus()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setEditingFocus ( )

Sets the focus to this TextArea, so this component is instantly registered for key press events.

The graphics context must be fully initialized before calling this method.

Definition at line 407 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.JEditTextArea.setCaretPosition(), and net.sf.gridarta.textedit.textarea.JEditTextArea.setCaretVisible().

Referenced by net.sf.gridarta.textedit.scripteditor.ScriptEditView.addTab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFirstLine()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setFirstLine ( final int  firstLine)

◆ setFont()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setFont ( @NotNull final Font  font)

Set the TextArea font.

Parameters
fontfont

Definition at line 261 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.setFont().

+ Here is the call graph for this function:

◆ setHorizontalOffset()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setHorizontalOffset ( final int  horizontalOffset)

Sets the horizontal offset of drawn lines.

This can be used to implement horizontal scrolling.

Parameters
horizontalOffsetoffset The new horizontal offset

Definition at line 356 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.setHorizontalOffset(), and net.sf.gridarta.textedit.textarea.JEditTextArea.updateScrollBars().

Referenced by net.sf.gridarta.textedit.textarea.JEditTextArea.AdjustHandler.adjustmentValueChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMagicCaretPosition()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setMagicCaretPosition ( final int  magicCaret)

Sets the `magic' caret position.

This can be used to preserve the column position when moving up and down lines.

Parameters
magicCaretthe magic caret position

Definition at line 752 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaConfig.setMagicCaret().

Referenced by net.sf.gridarta.textedit.textarea.actions.NextLine.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.PrevLine.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOrigin()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setOrigin ( final int  firstLine,
final int  horizontalOffset 
)

A fast way of changing both the first line and horizontal offset.

Parameters
firstLinethe new first line
horizontalOffsetthe new horizontal offset

Definition at line 373 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.setFirstLine(), net.sf.gridarta.textedit.textarea.TextAreaPainter.setHorizontalOffset(), and net.sf.gridarta.textedit.textarea.JEditTextArea.updateScrollBars().

Referenced by net.sf.gridarta.textedit.textarea.JEditTextArea.scrollTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOverwriteEnabled()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setOverwriteEnabled ( final boolean  overwrite)

Sets whether overwrite mode is active.

Parameters
overwritewhether overwrite mode is active

Definition at line 803 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.invalidateSelectedLines(), and net.sf.gridarta.textedit.textarea.TextAreaConfig.setOverwrite().

Referenced by net.sf.gridarta.textedit.textarea.actions.Overwrite.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedText()

◆ setSelectionRectangular()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setSelectionRectangular ( final boolean  rectangleSelect)

Sets if the selection should be rectangular.

Parameters
rectangleSelecttrue if the selection should be rectangular, false otherwise

Definition at line 820 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.invalidateSelectedLines(), and net.sf.gridarta.textedit.textarea.TextAreaSelection.setSelectionRectangular().

Referenced by net.sf.gridarta.textedit.textarea.actions.ToggleRectangle.actionPerformed(), and net.sf.gridarta.textedit.textarea.JEditTextArea.DragHandler.mouseDragged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setText()

void net.sf.gridarta.textedit.textarea.JEditTextArea.setText ( @NotNull final String  text)

Sets the entire text of this text area.

Definition at line 555 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaSelection.setText().

+ Here is the call graph for this function:

◆ updateBracketHighlight()

void net.sf.gridarta.textedit.textarea.JEditTextArea.updateBracketHighlight ( final int  newCaretPosition)
private

◆ updateScrollBars()

◆ xToOffset()

int net.sf.gridarta.textedit.textarea.JEditTextArea.xToOffset ( final int  line,
final int  x 
)

Converts an x co-ordinate to an offset within a line.

Parameters
linethe line
xthe x co-ordinate

Definition at line 497 of file JEditTextArea.java.

References net.sf.gridarta.textedit.textarea.TextAreaPainter.xToOffset().

Referenced by net.sf.gridarta.textedit.textarea.actions.NextLine.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevLine.actionPerformed(), and net.sf.gridarta.textedit.textarea.JEditTextArea.MouseHandler.mousePressed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ brackets

final TextAreaBrackets net.sf.gridarta.textedit.textarea.JEditTextArea.brackets = new TextAreaBrackets()
private

Definition at line 146 of file JEditTextArea.java.

◆ caret

final TextAreaCaret net.sf.gridarta.textedit.textarea.JEditTextArea.caret
private

Definition at line 126 of file JEditTextArea.java.

◆ CARET_TIMER

final Timer net.sf.gridarta.textedit.textarea.JEditTextArea.CARET_TIMER = new Timer(500, new CaretBlinker())
staticprivate

Definition at line 112 of file JEditTextArea.java.

◆ config

final TextAreaConfig net.sf.gridarta.textedit.textarea.JEditTextArea.config
private

The TextAreaConfig for this instance.

Definition at line 152 of file JEditTextArea.java.

◆ document

final SyntaxDocument net.sf.gridarta.textedit.textarea.JEditTextArea.document
private

◆ focusedComponent

JEditTextArea net.sf.gridarta.textedit.textarea.JEditTextArea.focusedComponent
staticprivate

Definition at line 109 of file JEditTextArea.java.

◆ horizontal

final JScrollBar net.sf.gridarta.textedit.textarea.JEditTextArea.horizontal = new JScrollBar(Adjustable.HORIZONTAL)
private

Definition at line 132 of file JEditTextArea.java.

◆ inputHandler

final InputHandler net.sf.gridarta.textedit.textarea.JEditTextArea.inputHandler
private

◆ LOG

final Category net.sf.gridarta.textedit.textarea.JEditTextArea.LOG = Logger.getLogger(JEditTextArea.class)
staticprivate

The Logger for printing log messages.

Definition at line 95 of file JEditTextArea.java.

◆ painter

final TextAreaPainter net.sf.gridarta.textedit.textarea.JEditTextArea.painter
private

Definition at line 120 of file JEditTextArea.java.

◆ popup

final JPopupMenu net.sf.gridarta.textedit.textarea.JEditTextArea.popup
private

Definition at line 123 of file JEditTextArea.java.

◆ scrollBarsInitialized

boolean net.sf.gridarta.textedit.textarea.JEditTextArea.scrollBarsInitialized
private

Definition at line 134 of file JEditTextArea.java.

◆ selection

final TextAreaSelection net.sf.gridarta.textedit.textarea.JEditTextArea.selection
private

Definition at line 143 of file JEditTextArea.java.

◆ serialVersionUID

final long net.sf.gridarta.textedit.textarea.JEditTextArea.serialVersionUID = 1L
staticprivate

Serial Version UID.

Definition at line 100 of file JEditTextArea.java.

◆ unmodifiedText

String net.sf.gridarta.textedit.textarea.JEditTextArea.unmodifiedText = ""
private

The text contents in the last "unmodified" state.

Definition at line 106 of file JEditTextArea.java.

◆ vertical

final JScrollBar net.sf.gridarta.textedit.textarea.JEditTextArea.vertical = new JScrollBar(Adjustable.VERTICAL)
private

The documentation for this class was generated from the following file: