com.vaadin.flow.component.

Class KeyPressEvent

All Implemented Interfaces:

Serializable

@DomEvent("keypress") public class KeyPressEvent extends KeyboardEvent

The event when a key is pressed.

Since:

1.0

Author:

Vaadin Ltd

See Also:

  • Constructor Details

    • KeyPressEvent

      public KeyPressEvent(Component source, boolean fromClient, @EventData("event.key") String key, @EventData("event.code") String code, @EventData("event.location") int location, @EventData("event.ctrlKey") boolean ctrlKey, @EventData("event.shiftKey") boolean shiftKey, @EventData("event.altKey") boolean altKey, @EventData("event.metaKey") boolean metaKey, @EventData("event.repeat") boolean repeat, @EventData("event.isComposing") boolean composing)

      Creates a new keyboard event.

      Parameters:

      source - the component that fired the event

      fromClient - true if the event was originally fired on the client, false if the event originates from server-side logic

      key - the string value representing the key

      code - the string value representing the code

      location - the integer value representing the location of the key

      ctrlKey - true if the control key was down when the event was fired, false otherwise

      shiftKey - true if the shift key was down when the event was fired, false otherwise

      altKey - true if the alt key was down when the event was fired, false otherwise

      metaKey - true if the meta key was down when the event was fired, false otherwise

      repeat - true if the key has been pressed in a sustained manner

      composing - true if the key event occurred as part of a composition session

    • KeyPressEvent

      public KeyPressEvent(Component source, String key)

      Creates a new server-side keyboard event with no additional information.

      Parameters:

      source - the component that fired the event

      key - the key for this event

    • KeyPressEvent

      public KeyPressEvent(Component source, String key, String code)

      Creates a new server-side keyboard event with no additional information.

      Parameters:

      source - the component that fired the event

      key - the key for this event

      code - the code for this event