Interface KeyEvents.Builder

Enclosing class:
KeyEvents

public static interface KeyEvents.Builder
A Builder for adding a key event to a component, with a default onKeyRelease trigger and condition JComponent.WHEN_FOCUSED.
See Also:
  • Method Details

    • keyCode

      KeyEvents.Builder keyCode(int keyCode)
      Parameters:
      keyCode - the key code
      Returns:
      this builder instance
    • keyChar

      KeyEvents.Builder keyChar(char keyChar)
      Parameters:
      keyChar - the key char
      Returns:
      this builder instance
    • modifiers

      KeyEvents.Builder modifiers(int modifiers)
      Parameters:
      modifiers - the modifiers
      Returns:
      this builder instance
    • onKeyRelease

      KeyEvents.Builder onKeyRelease(boolean onKeyRelease)
      Default false.
      Parameters:
      onKeyRelease - true if on key release
      Returns:
      this builder instance
    • keyStroke

      KeyEvents.Builder keyStroke(KeyStroke keyStroke)
      Parameters:
      keyStroke - the key stroke
      Returns:
      this builder instance
    • condition

      KeyEvents.Builder condition(int condition)
      Sets the key event condition, JComponent.WHEN_FOCUSED by default.
      Parameters:
      condition - the condition
      Returns:
      this builder instance
    • action

      KeyEvents.Builder action(Action action)
      Parameters:
      action - the action, if null then the action binding is removed
      Returns:
      this builder instance
    • enable

      KeyEvents.Builder enable(JComponent... components)
      Builds the key event and enables it on the given components
      Parameters:
      components - the components
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case no action has been set
    • enable

      Builds the key event and enables it on the given components
      Parameters:
      components - the components
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case no action has been set
    • disable

      KeyEvents.Builder disable(JComponent... components)
      Disables this key event on the given components
      Parameters:
      components - the components
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case no action has been set
    • disable

      KeyEvents.Builder disable(Collection<JComponent> components)
      Disables this key event on the given components
      Parameters:
      components - the components
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case no action has been set