Class BaseRSyntaxTextArea

    • Field Detail

      • m_AnyChangeListeners

        protected Set<ChangeListener> m_AnyChangeListeners
        the listeners for any changes to the text.
    • Constructor Detail

      • BaseRSyntaxTextArea

        public BaseRSyntaxTextArea()
        Constructs a new TextArea. A default model is set, the initial string is null, and rows/columns are set to 0.
      • BaseRSyntaxTextArea

        public BaseRSyntaxTextArea​(String text)
        Constructs a new TextArea with the specified text displayed. A default model is created and rows/columns are set to 0.
        Parameters:
        text - the text to be displayed, or null
      • BaseRSyntaxTextArea

        public BaseRSyntaxTextArea​(int rows,
                                   int columns)
        Constructs a new empty TextArea with the specified number of rows and columns. A default model is created, and the initial string is null.
        Parameters:
        rows - the number of rows >= 0
        columns - the number of columns >= 0
      • BaseRSyntaxTextArea

        public BaseRSyntaxTextArea​(String text,
                                   int rows,
                                   int columns)
        Constructs a new TextArea with the specified text and number of rows and columns. A default model is created.
        Parameters:
        text - the text to be displayed, or null
        rows - the number of rows >= 0
        columns - the number of columns >= 0
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the text area.
      • getParentFrame

        public Frame getParentFrame()
        Tries to determine the frame the container is part of.
        Returns:
        the parent frame if one exists or null if not
      • getParentDialog

        public Dialog getParentDialog()
        Tries to determine the dialog this panel is part of.
        Returns:
        the parent dialog if one exists or null if not
      • getParentInternalFrame

        public JInternalFrame getParentInternalFrame()
        Tries to determine the internal frame this panel is part of.
        Returns:
        the parent internal frame if one exists or null if not
      • setTextFont

        public void setTextFont​(Font value)
        Sets the text font.
        Specified by:
        setTextFont in interface TextAreaComponent
        Parameters:
        value - the font
      • append

        public void append​(String str,
                           int limit)
        Appends the string at the end and keeps the number of lines to the given limit (discarding from the top).
        Parameters:
        str - the line to append
        limit - the maximum number of lines to keep, ignored if <= 0
      • printText

        public void printText()
        Pops up a print dialog.
      • selectFont

        public void selectFont()
        Pops up a dialog for selecting the font.
      • getLineCount

        public int getLineCount()
        Returns the number of lines in the document (= # of elements).
        Overrides:
        getLineCount in class JTextArea
        Returns:
        the number of lines
      • gotoLine

        public boolean gotoLine​(int index)
        Jumps to the specified line.
        Parameters:
        index - the 0-based index for the line
        Returns:
        true if successfully jumped
      • caretToLine

        public int caretToLine​(int position)
        Determines the line number for the caret position.
        Parameters:
        position - the caret position
        Returns:
        the line number, -1 if failed to determine
      • removeBeforeLine

        public boolean removeBeforeLine​(int index)
        Removes all lines before the specified one.
        Parameters:
        index - the 0-based index of the line to become the new first line
        Returns:
        true if successful removed
      • notifyAnyChangeListeners

        protected void notifyAnyChangeListeners()
        Notifies all listeners that some change to the text occurred.