Class BaseTextArea

    • Field Detail

      • m_AnyChangeListeners

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

      • BaseTextArea

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

        public BaseTextArea​(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
      • BaseTextArea

        public BaseTextArea​(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
      • BaseTextArea

        public BaseTextArea​(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
      • BaseTextArea

        public BaseTextArea​(Document doc)
        Constructs a new BaseTextArea with the given document model, and defaults for all of the other arguments (null, 0, 0).
        Parameters:
        doc - the model to use
      • BaseTextArea

        public BaseTextArea​(Document doc,
                            String text,
                            int rows,
                            int columns)
        Constructs a new BaseTextArea with the specified number of rows and columns, and the given model. All of the constructors feed through this constructor.
        Parameters:
        doc - the model to use, or create a default one if null
        text - the text to be displayed, null if none
        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
      • 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
      • 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
      • notifyAnyChangeListeners

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