Class KeyHandler


  • public class KeyHandler
    extends java.lang.Object
    Handles keyboard input processing.
    • Constructor Detail

      • KeyHandler

        public KeyHandler​(@Nullable
                          @Nullable java.io.Writer debugKeyboard,
                          @NotNull
                          @NotNull KeybindingsManager keybindingsManager,
                          @NotNull
                          @NotNull CommandQueue commandQueue,
                          @NotNull
                          @NotNull JXCWindowRenderer windowRenderer,
                          @NotNull
                          @NotNull KeyHandlerListener keyHandlerListener)
        Creates a new instance.
        Parameters:
        debugKeyboard - the writer for logging keyboard debug output; may
        keybindingsManager - the keybindings manager to use
        commandQueue - the command queue to use
        windowRenderer - the window renderer to use
        keyHandlerListener - the key handler listener to notify
    • Method Detail

      • setKeyBindings

        public void setKeyBindings​(@NotNull
                                   @NotNull KeyBindings keyBindings)
        Sets the active KeyBindings.
        Parameters:
        keyBindings - the key bindings or null to unset
      • keyPressed

        public void keyPressed​(@NotNull
                               @NotNull java.awt.event.KeyEvent e)
        Handles a "key pressed" event.
        Parameters:
        e - the key event to handle
      • keyReleased

        public void keyReleased​(@NotNull
                                @NotNull java.awt.event.KeyEvent e)
        Handles a "key released" event.
        Parameters:
        e - the key event to handle