private static boolean isCtrlY(AWTEvent event) {
    if (!(event instanceof KeyEvent keyEvent)) return false;
    int modifiers = keyEvent.getModifiers();
    return (keyEvent.getKeyCode() == KeyEvent.VK_Y &&
            ((modifiers & InputEvent.CTRL_MASK) != 0) &&
            ((modifiers & InputEvent.SHIFT_MASK) == 0) &&
            ((modifiers & InputEvent.ALT_GRAPH_MASK) == 0) &&
            ((modifiers & InputEvent.ALT_MASK) == 0) &&
            ((modifiers & InputEvent.META_MASK) == 0));
  }
private static boolean isCtrlY(AWTEvent event)