Skip to content

KeyLayout

final class KeyLayout
Package: dev.joid.lib.input.key · Module: core · Source: KeyLayout.java

Translates the place of a letter or punctuation key into the key that the keyboard layout of the user types there.

A window library reports a key by its place on a US QWERTY keyboard: on a French AZERTY keyboard, the key that types a arrives as Key.Q. The input forwarder of a backend gives each key press two keys, its place and the key that the layout names (Input forwarding); a KeyLayout computes the second from the first. Only the letters A to Z and the punctuation keys from Key.APOSTROPHE to Key.GRAVE_ACCENT depend on the layout; every other key passes through unchanged.

ReturnsSignatureSummary
KeyLayoutfrom(Function<Key,String> nameFunction) factoryCreates a layout from a function that returns the text that a place of the keyboard types with the current layout, such as the key name of the window library.

ReturnsSignatureSummary
Keytranslate(Key key)Returns the key that the layout types at a place.
KeyfromCharacter(char character) staticReturns the letter or punctuation key that types a character, whatever its case, or null for any other character.
booleanisLayoutKey(Key key) staticIf true, the key depends on the layout: a letter or a punctuation key.

KeyLayout from(Function<Key,String> nameFunction) factory

Creates a layout from a function that returns the text that a place of the keyboard types with the current layout, such as the key name of the window library. The function may return null when the place types nothing.

Key translate(Key key)

Returns the key that the layout types at a place. The place comes back unchanged when it does not depend on the layout, or when the name function does not give one character that JOID knows.

Key fromCharacter(char character) static

Returns the letter or punctuation key that types a character, whatever its case, or null for any other character.

boolean isLayoutKey(Key key) static

If true, the key depends on the layout: a letter or a punctuation key.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page