Package jexer

Class TText

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>, Scrollable

    public class TText
    extends TScrollableWidget
    TText implements a simple scrollable text area. It reflows automatically on resize.
    • Constructor Detail

      • TText

        public TText​(TWidget parent,
                     java.lang.String text,
                     int x,
                     int y,
                     int width,
                     int height)
        Public constructor.
        Parameters:
        parent - parent widget
        text - text on the screen
        x - column relative to parent
        y - row relative to parent
        width - width of text area
        height - height of text area
      • TText

        public TText​(TWidget parent,
                     java.lang.String text,
                     int x,
                     int y,
                     int width,
                     int height,
                     java.lang.String colorKey)
        Public constructor.
        Parameters:
        parent - parent widget
        text - text on the screen
        x - column relative to parent
        y - row relative to parent
        width - width of text area
        height - height of text area
        colorKey - ColorTheme key color to use for foreground text. Default is "ttext".
    • Method Detail

      • setWidth

        public void setWidth​(int width)
        Override TWidget's width: we need to set child widget widths.
        Overrides:
        setWidth in class TWidget
        Parameters:
        width - new widget width
      • setHeight

        public void setHeight​(int height)
        Override TWidget's height: we need to set child widget heights. time.
        Overrides:
        setHeight in class TWidget
        Parameters:
        height - new widget height
      • draw

        public void draw()
        Draw the text box.
        Overrides:
        draw in class TWidget
      • onMouseDown

        public void onMouseDown​(TMouseEvent mouse)
        Handle mouse press events.
        Overrides:
        onMouseDown in class TWidget
        Parameters:
        mouse - mouse button press event
      • onKeypress

        public void onKeypress​(TKeypressEvent keypress)
        Handle keystrokes.
        Overrides:
        onKeypress in class TWidget
        Parameters:
        keypress - keystroke event
      • reflowData

        public void reflowData()
        Resize text and scrollbars for a new width/height.
        Overrides:
        reflowData in class TScrollableWidget
      • setText

        public void setText​(java.lang.String text)
        Set the text.
        Parameters:
        text - new text to display
      • getText

        public java.lang.String getText()
        Get the text.
        Returns:
        the text
      • addLine

        public void addLine​(java.lang.String line)
        Convenience method used by TWindowLoggerOutput.
        Parameters:
        line - new line to add
      • setJustification

        public void setJustification​(TText.Justification justification)
        Set justification.
        Parameters:
        justification - NONE, LEFT, CENTER, RIGHT, or FULL
      • leftJustify

        public void leftJustify()
        Left-justify the text.
      • centerJustify

        public void centerJustify()
        Center-justify the text.
      • rightJustify

        public void rightJustify()
        Right-justify the text.
      • fullJustify

        public void fullJustify()
        Fully-justify the text.
      • unJustify

        public void unJustify()
        Un-justify the text.