Class TextEditor

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class TextEditor extends JTextArea
See Also:
  • Method Details

    • deleteCurrentLine

      public void deleteCurrentLine()
      Deletes the current line and if there is no text, sets the caret to the end of the previous line.
    • duplicateCurrentLine

      public void duplicateCurrentLine()
      Duplicates the current line, moving the caret to the new line but keeping its position relative to that line.
    • moveLine

      public void moveLine(int direction)
      Moves the current line up or down.
      Parameters:
      direction - Direction to move the line, where 1 = down and -1 = up.
    • toggleComment

      public void toggleComment()
      Inserts a comment and a space if there is none, or removes an existing comment character if there is one. Works best if comment character is followed by a space.