Package jexer.bits

Class MnemonicString


  • public class MnemonicString
    extends java.lang.Object
    MnemonicString is used to render a string like "&File" into a highlighted 'F' and the rest of 'ile'. To insert a literal '&', use two '&&' characters, e.g. "&File && Stuff" would be "File & Stuff" with the first 'F' highlighted.
    • Constructor Summary

      Constructors 
      Constructor Description
      MnemonicString​(java.lang.String label)
      Public constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getRawLabel()
      Get the raw (uncolored) string.
      int getScreenShortcutIdx()
      Get the screen location of the highlighted character.
      int getShortcut()
      Get the keyboard shortcut character.
      int getShortcutIdx()
      Get location of the highlighted character.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MnemonicString

        public MnemonicString​(java.lang.String label)
        Public constructor.
        Parameters:
        label - widget label or title. Label must contain a keyboard shortcut, denoted by prefixing a letter with "&", e.g. "&File"
    • Method Detail

      • getShortcut

        public int getShortcut()
        Get the keyboard shortcut character.
        Returns:
        the highlighted character
      • getShortcutIdx

        public int getShortcutIdx()
        Get location of the highlighted character.
        Returns:
        location of the highlighted character
      • getScreenShortcutIdx

        public int getScreenShortcutIdx()
        Get the screen location of the highlighted character.
        Returns:
        the number of text cells required to display from the beginning of the label to shortcutIdx
      • getRawLabel

        public java.lang.String getRawLabel()
        Get the raw (uncolored) string.
        Returns:
        the raw (uncolored) string