Interface ShortcutAdapter

All Known Implementing Classes:
Bucket, CanvasInputProcessor, EditorTool, Eraser, Pen, Square, ToolInputAdapter

public interface ShortcutAdapter
The ShortcutAdapter interface defines methods for handling shortcuts in an application.

This interface provides default implementations for adding and removing keys from the set of pressed keys, as well as checking if a given set of keys is a shortcut.

The implementation uses a set of pressed keys to keep track of the keys that are currently being pressed.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<Integer>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    addKey(int key)
    Adds a key to the set of pressed keys.
    default boolean
    isShortcut(int... keys)
    Determines if the given set of keys is a shortcut.
    default boolean
    isShortcut(int key, int... modifiers)
     
    default boolean
     
    default void
    removeKey(int key)
    Removes a key from the set of pressed keys.
  • Field Details

    • pressedKeys

      static final Set<Integer> pressedKeys
  • Method Details

    • isShortcut

      default boolean isShortcut(int... keys)
      Determines if the given set of keys is a shortcut.
      Parameters:
      keys - the set of keys to check
      Returns:
      true if the set of keys is a shortcut, false otherwise
    • isShortcut

      default boolean isShortcut(Shortcuts.Shortcut shortcut)
    • isShortcut

      default boolean isShortcut(int key, int... modifiers)
    • addKey

      default void addKey(int key)
      Adds a key to the set of pressed keys.
      Parameters:
      key - the key to add
    • removeKey

      default void removeKey(int key)
      Removes a key from the set of pressed keys.
      Parameters:
      key - the key to remove