Package jexer

Class TLabel

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

    public class TLabel
    extends TWidget
    TLabel implements a simple label, with an optional mnemonic hotkey action associated with it.
    • Constructor Detail

      • TLabel

        public TLabel​(TWidget parent,
                      java.lang.String text,
                      int x,
                      int y)
        Public constructor, using the default "tlabel" for colorKey.
        Parameters:
        parent - parent widget
        text - label on the screen
        x - column relative to parent
        y - row relative to parent
      • TLabel

        public TLabel​(TWidget parent,
                      java.lang.String text,
                      int x,
                      int y,
                      TAction action)
        Public constructor, using the default "tlabel" for colorKey.
        Parameters:
        parent - parent widget
        text - label on the screen
        x - column relative to parent
        y - row relative to parent
        action - to call when shortcut is pressed
      • TLabel

        public TLabel​(TWidget parent,
                      java.lang.String text,
                      int x,
                      int y,
                      java.lang.String colorKey)
        Public constructor.
        Parameters:
        parent - parent widget
        text - label on the screen
        x - column relative to parent
        y - row relative to parent
        colorKey - ColorTheme key color to use for foreground text
      • TLabel

        public TLabel​(TWidget parent,
                      java.lang.String text,
                      int x,
                      int y,
                      java.lang.String colorKey,
                      TAction action)
        Public constructor.
        Parameters:
        parent - parent widget
        text - label on the screen
        x - column relative to parent
        y - row relative to parent
        colorKey - ColorTheme key color to use for foreground text
        action - to call when shortcut is pressed
      • TLabel

        public TLabel​(TWidget parent,
                      java.lang.String text,
                      int x,
                      int y,
                      java.lang.String colorKey,
                      boolean useWindowBackground)
        Public constructor.
        Parameters:
        parent - parent widget
        text - label on the screen
        x - column relative to parent
        y - row relative to parent
        colorKey - ColorTheme key color to use for foreground text
        useWindowBackground - if true, use the window's background color
      • TLabel

        public TLabel​(TWidget parent,
                      java.lang.String text,
                      int x,
                      int y,
                      java.lang.String colorKey,
                      boolean useWindowBackground,
                      TAction action)
        Public constructor.
        Parameters:
        parent - parent widget
        text - label on the screen
        x - column relative to parent
        y - row relative to parent
        colorKey - ColorTheme key color to use for foreground text
        useWindowBackground - if true, use the window's background color
        action - to call when shortcut is pressed
    • Method Detail

      • setWidth

        public void setWidth​(int width)
        Override TWidget's width: we can only set width at construction time.
        Overrides:
        setWidth in class TWidget
        Parameters:
        width - new widget width (ignored)
      • setHeight

        public void setHeight​(int height)
        Override TWidget's height: we can only set height at construction time.
        Overrides:
        setHeight in class TWidget
        Parameters:
        height - new widget height (ignored)
      • draw

        public void draw()
        Draw a static label.
        Overrides:
        draw in class TWidget
      • getLabel

        public java.lang.String getLabel()
        Get label raw text.
        Returns:
        label text
      • getMnemonic

        public MnemonicString getMnemonic()
        Get the mnemonic string for this label.
        Returns:
        mnemonic string
      • setLabel

        public void setLabel​(java.lang.String label)
        Set label text.
        Parameters:
        label - new label text
      • getColorKey

        public java.lang.String getColorKey()
        Get the label color.
        Returns:
        the ColorTheme key color to use for foreground text
      • setColorKey

        public void setColorKey​(java.lang.String colorKey)
        Set the label color.
        Parameters:
        colorKey - ColorTheme key color to use for foreground text
      • dispatch

        public void dispatch()
        Act as though the mnemonic shortcut was pressed.