Class KeyboardLayout

java.lang.Object
technology.sola.engine.input.KeyboardLayout

@NullMarked public final class KeyboardLayout extends Object
KeyboardLayout contains information for the current keyboard layout. This includes things like what characters should render when shift is pressed. Defaults to KeyboardLayout.Type.QWERTY.
  • Method Details

    • shift

      public static char shift(char character)
      Returns the shifted variant of the character for the current keyboard type. If there is no shifted variant then the original character will return.
      Parameters:
      character - the character to get the shift variant for
      Returns:
      the shifted variant or the original character if there is no shifted variant
    • hasShift

      public static boolean hasShift(int keyCode)
      Checks to see if a keyCode has a shifted variant character or not.
      Parameters:
      keyCode - the key code to check
      Returns:
      true if it has a shifted variant for the current keyboard type
    • getType

      public static KeyboardLayout.Type getType()
      Returns:
      the current KeyboardLayout.Type of keyboard in use
    • setType

      public static void setType(KeyboardLayout.Type type)
      Sets the KeyboardLayout.Type of keyboard in use.
      Parameters:
      type - the new type of keyboard in use