Change KeyCodeCombination.getDisplayText to be more readable

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8, jfx11
    • Component/s: javafx
    • x86_64
    • windows_10

      A DESCRIPTION OF THE PROBLEM :
      If you make a KeyCodeCombination that includes KeyCode.BACK_SPACE, the getDisplayText for that will return "Back Space" instead of "Backspace"

      Looking at the implementation of getDisplayText, it seems to be calling KeyCode.toString, which returns the source-code name of the Enum, and then does some processing to get the correct case on the words. This seems like it could be replaced with a call to the getName() method on KeyCode, which returns a nice human-readable representation of the key

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached source on Windows

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The sample program should print "Ctrl+Backpace"
      ACTUAL -
      The sample program prints "Ctrl+Back Space"

      ---------- BEGIN SOURCE ----------
      import javafx.scene.input.KeyCode;
      import javafx.scene.input.KeyCodeCombination;
      import javafx.scene.input.KeyCombination;

      public class BasicJavaFx
      {
          public static void main(
              final String... args)
          {
              final KeyCodeCombination keyCodeCombination = new KeyCodeCombination(
                  KeyCode.BACK_SPACE,
                  KeyCombination.SHORTCUT_DOWN);

              System.out.println(keyCodeCombination.getDisplayText());
          }
      }
      ---------- END SOURCE ----------

            Assignee:
            Ambarish Rapte
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: