src/main/java/com/spinyowl/legui/component/misc/listener/textarea/TextAreaFieldKeyEventListener.java
@Override
  public void process(KeyboardEvent event) {
    KeyCode keyCode = event.getKey().getKeyCode();
    if (keyCode == KeyCode.LEFT_SHIFT
        || keyCode == KeyCode.RIGHT_SHIFT
        || keyCode == KeyCode.LEFT_CONTROL
        || keyCode == KeyCode.RIGHT_CONTROL
        || keyCode == KeyCode.LEFT_ALT
        || keyCode == KeyCode.RIGHT_ALT) {
      return;
    }

    TextAreaField textAreaField = (TextAreaField) event.getTargetComponent();
    boolean pressed = event.getAction() != KeyAction.RELEASE;

    String oldText = textAreaField.getTextState().getText();

    if (!pressed) {
      EventProcessorProvider.getInstance().pushEvent(
          new TextAreaFieldUpdateEvent(textAreaField, event.getContext(), event.getFrame()));
      return;
    }

    processKey(textAreaField, event);
    String newText = textAreaField.getTextState().getText();
    if (!oldText.equals(newText)) {
      EventProcessorProvider.getInstance().pushEvent(
          new TextAreaFieldContentChangeEvent<>(
              (TextAreaField) event.getTargetComponent(),
              event.getContext(), event.getFrame(), oldText, newText));
    }
    EventProcessorProvider.getInstance().pushEvent(
        new TextAreaFieldUpdateEvent(textAreaField, event.getContext(), event.getFrame()));
  }
/**
   * Used to handle {@link KeyEvent}.
   *
   * @param event event to handle.
   */
Used to handle  KeyEvent.
@param event event to handle.
Used to handle KeyEvent . @param event event to handle .
@Override
  public void process(KeyboardEvent event) {
    KeyCode keyCode = event.getKey().getKeyCode();
    if (keyCode == KeyCode.LEFT_SHIFT
        || keyCode == KeyCode.RIGHT_SHIFT
        || keyCode == KeyCode.LEFT_CONTROL
        || keyCode == KeyCode.RIGHT_CONTROL
        || keyCode == KeyCode.LEFT_ALT
        || keyCode == KeyCode.RIGHT_ALT) {
      return;
    }
    TextAreaField textAreaField = (TextAreaField) event.getTargetComponent();
    boolean pressed = event.getAction() != KeyAction.RELEASE;
    String oldText = textAreaField.getTextState().getText();
    if (!pressed) {
      EventProcessorProvider.getInstance().pushEvent(
          new TextAreaFieldUpdateEvent(textAreaField, event.getContext(), event.getFrame()));
      return;
    }
    processKey(textAreaField, event);
    String newText = textAreaField.getTextState().getText();
    if (!oldText.equals(newText)) {
      EventProcessorProvider.getInstance().pushEvent(
          new TextAreaFieldContentChangeEvent<>(
              (TextAreaField) event.getTargetComponent(),
              event.getContext(), event.getFrame(), oldText, newText));
    }
    EventProcessorProvider.getInstance().pushEvent(
        new TextAreaFieldUpdateEvent(textAreaField, event.getContext(), event.getFrame()));
  }
@ Override public void process ( KeyboardEvent event ) { KeyCode keyCode = event . getKey ( ) . getKeyCode ( ) ; if ( keyCode == KeyCode . LEFT_SHIFT || keyCode == KeyCode . RIGHT_SHIFT || keyCode == KeyCode . LEFT_CONTROL || keyCode == KeyCode . RIGHT_CONTROL || keyCode == KeyCode . LEFT_ALT || keyCode == KeyCode . RIGHT_ALT ) { return ; } TextAreaField textAreaField = ( TextAreaField ) event . getTargetComponent ( ) ; boolean pressed = event . getAction ( ) != KeyAction . RELEASE ; String oldText = textAreaField . getTextState ( ) . getText ( ) ; if ( ! pressed ) { EventProcessorProvider . getInstance ( ) . pushEvent ( new TextAreaFieldUpdateEvent ( textAreaField , event . getContext ( ) , event . getFrame ( ) ) ) ; return ; } processKey ( textAreaField , event ) ; String newText = textAreaField . getTextState ( ) . getText ( ) ; if ( ! oldText . equals ( newText ) ) { EventProcessorProvider . getInstance ( ) . pushEvent ( new TextAreaFieldContentChangeEvent < > ( ( TextAreaField ) event . getTargetComponent ( ) , event . getContext ( ) , event . getFrame ( ) , oldText , newText ) ) ; } EventProcessorProvider . getInstance ( ) . pushEvent ( new TextAreaFieldUpdateEvent ( textAreaField , event . getContext ( ) , event . getFrame ( ) ) ) ; }
Used to handle {@link KeyEvent}.
Used to handle { @link KeyEvent } .