X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FMnemonicString.java;h=5977ed56c71064262d19f0fed0afc15686ffd59e;hb=0c28ec38449a59cf34cf5b3c13ea02add1ee57c5;hp=9f7d178693c700d8edebc803da2a677ff4b8f3e7;hpb=e16dda65585466c8987bd1efd718431450a96605;p=fanfix.git diff --git a/src/jexer/bits/MnemonicString.java b/src/jexer/bits/MnemonicString.java index 9f7d178..5977ed5 100644 --- a/src/jexer/bits/MnemonicString.java +++ b/src/jexer/bits/MnemonicString.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2016 Kevin Lamonte + * Copyright (C) 2019 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -29,60 +29,41 @@ package jexer.bits; /** - * 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. + * 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. */ -public final class MnemonicString { +public class MnemonicString { + + // ------------------------------------------------------------------------ + // Variables -------------------------------------------------------------- + // ------------------------------------------------------------------------ /** * Keyboard shortcut to activate this item. */ private char shortcut; - /** - * Get the keyboard shortcut character. - * - * @return the highlighted character - */ - public char getShortcut() { - return shortcut; - } - /** * Location of the highlighted character. */ private int shortcutIdx = -1; - /** - * Get location of the highlighted character. - * - * @return location of the highlighted character - */ - public int getShortcutIdx() { - return shortcutIdx; - } - /** * The raw (uncolored) string. */ private String rawLabel; - /** - * Get the raw (uncolored) string. - * - * @return the raw (uncolored) string - */ - public String getRawLabel() { - return rawLabel; - } + // ------------------------------------------------------------------------ + // Constructors ----------------------------------------------------------- + // ------------------------------------------------------------------------ /** * Public constructor. * * @param label widget label or title. Label must contain a keyboard - * shortcut, denoted by prefixing a letter with "&", e.g. "&File" + * shortcut, denoted by prefixing a letter with "&", e.g. "&File" */ public MnemonicString(final String label) { @@ -116,4 +97,36 @@ public final class MnemonicString { } this.rawLabel = newLabel; } + + // ------------------------------------------------------------------------ + // MnemonicString --------------------------------------------------------- + // ------------------------------------------------------------------------ + + /** + * Get the keyboard shortcut character. + * + * @return the highlighted character + */ + public char getShortcut() { + return shortcut; + } + + /** + * Get location of the highlighted character. + * + * @return location of the highlighted character + */ + public int getShortcutIdx() { + return shortcutIdx; + } + + /** + * Get the raw (uncolored) string. + * + * @return the raw (uncolored) string + */ + public String getRawLabel() { + return rawLabel; + } + }