com.harium.etyl.commons.event.KeyEvent.isKeyDown()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中com.harium.etyl.commons.event.KeyEvent.isKeyDown()方法的一些代码示例,展示了KeyEvent.isKeyDown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.isKeyDown()方法的具体详情如下:
包路径:com.harium.etyl.commons.event.KeyEvent
类名称:KeyEvent
方法名:isKeyDown

KeyEvent.isKeyDown介绍

暂无

代码示例

代码示例来源:origin: com.harium/etyl

@Override
public GUIEvent updateKeyboard(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_TAB)) {
    return GUIEvent.NEXT_COMPONENT;
  }
  return GUIEvent.NONE;
}

代码示例来源:origin: com.harium.etyl/commons

public boolean isAnyKeyDown(int... keyCodes) {
  if (consumed)
    return false;
  for (int keyCode : keyCodes) {
    if (isKeyDown(keyCode)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: com.harium/etyl

@Override
public GUIEvent updateKeyboard(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_TAB)) {
    return GUIEvent.NEXT_COMPONENT;
  }
  return GUIEvent.NONE;
}

代码示例来源:origin: com.harium/etyl

@Override
public GUIEvent updateKeyboard(KeyEvent event) {
  if(event.isKeyDown(KeyEvent.VK_TAB)) {
    return GUIEvent.NEXT_COMPONENT;
  }
  if(event.isKeyDown(KeyEvent.VK_ENTER)) {
    this.updateEvent(GUIEvent.MOUSE_LEFT_BUTTON_DOWN);
  }/*else if(event.getReleased(Tecla.TSK_ENTER)) {
    return GUIEvent.MOUSE_LEFT_BUTTON_UP;
  }*/
  return GUIEvent.NONE;
}

代码示例来源:origin: com.harium/etyl

@Override
public GUIEvent updateKeyboard(KeyEvent event) {
  if (onFocus) {
    if (event.isKeyDown(KeyEvent.VK_RIGHT)) {
      setValue(value + 1);
    }
    if (event.isKeyDown(KeyEvent.VK_LEFT)) {
      setValue(value + 1);
    }
  }
  return GUIEvent.NONE;
}

代码示例来源:origin: com.harium/etyl

private GUIEvent updateReleased(KeyEvent event) {
  if (control) {
    if (event.isKeyDown(KeyEvent.VK_CTRL_RIGHT)||event.isKeyDown(KeyEvent.VK_CTRL_LEFT)) {
      control = false;
    }
  }
  if (shift) {
    if (event.isKeyUp(KeyEvent.VK_SHIFT_RIGHT)||event.isKeyUp(KeyEvent.VK_SHIFT_LEFT)) {
      shift = false;
      minMark = cursor;
      maxMark = cursor;
    }
  }
  return GUIEvent.NONE;
}

代码示例来源:origin: com.harium/etyl

private GUIEvent updatePressed(KeyEvent event) {
    if ((event.isKeyDown(KeyEvent.VK_SHIFT_RIGHT))||(event.isKeyDown(KeyEvent.VK_SHIFT_LEFT))) {
      shift = true;
      maxMark = cursor;
  if (event.isKeyDown(KeyEvent.VK_END)) {
    cursor = text.length();
  else if (event.isKeyDown(KeyEvent.VK_HOME)) {
    moveCursorToStart();
    if (event.isKeyDown(KeyEvent.VK_CTRL_RIGHT)||event.isKeyDown(KeyEvent.VK_CTRL_LEFT)) {
      control = true;
  if (event.isKeyDown(KeyEvent.VK_LEFT)) {
    if (shift && !control) {
  else if (event.isKeyDown(KeyEvent.VK_RIGHT)) {
  if (event.isKeyDown(KeyEvent.VK_TAB)) {

代码示例来源:origin: com.harium.propan/propan

public void updateKeyboard(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_UP_ARROW)) {
    forwardPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_UP_ARROW)) {
  if (event.isKeyDown(KeyEvent.VK_DOWN_ARROW)) {
    backwardPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_DOWN_ARROW)) {
  if (event.isKeyDown(KeyEvent.VK_NUMPAD8)) {
    upPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_NUMPAD8)) {
  if (event.isKeyDown(KeyEvent.VK_NUMPAD2)) {
    downPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_NUMPAD2)) {
  if (event.isKeyDown(KeyEvent.VK_NUMPAD6)) {
    rightPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_NUMPAD6)) {
  if (event.isKeyDown(KeyEvent.VK_NUMPAD4)) {
    leftPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_NUMPAD4)) {
  if (event.isKeyDown(KeyEvent.VK_SPACE)) {
    liftPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_SPACE)) {

代码示例来源:origin: com.harium.propan/propan-gdx

public void updateKeyboard(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_W)) {
    forward = true;
  } else if (event.isKeyUp(KeyEvent.VK_W)) {
    forward = false;
  if (event.isKeyDown(KeyEvent.VK_S)) {
    backward = true;
  } else if (event.isKeyUp(KeyEvent.VK_S)) {
    backward = false;
  if (event.isKeyDown(KeyEvent.VK_A)) {
    left = true;
  } else if (event.isKeyUp(KeyEvent.VK_A)) {
    left = false;
  if (event.isKeyDown(KeyEvent.VK_D)) {
    right = true;
  } else if (event.isKeyUp(KeyEvent.VK_D)) {
  if (event.isKeyDown(KeyEvent.VK_UP)) {
    up = true;
  } else if (event.isKeyUp(KeyEvent.VK_UP)) {
    up = false;
  if (event.isKeyDown(KeyEvent.VK_DOWN)) {
    down = true;
  } else if (event.isKeyUp(KeyEvent.VK_DOWN)) {
    down = false;

代码示例来源:origin: com.harium.propan/propan

public void updateKeyboard(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_W)) {
    forwardPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_W)) {
  if (event.isKeyDown(KeyEvent.VK_S)) {
    backwardPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_S)) {
  if (event.isKeyDown(KeyEvent.VK_A)) {
    strafeLeftPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_A)) {
  if (event.isKeyDown(KeyEvent.VK_D)) {
    strafeRightPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_D)) {
  if (event.isKeyDown(KeyEvent.VK_UP_ARROW)) {
    upPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_UP_ARROW)) {
  if (event.isKeyDown(KeyEvent.VK_DOWN_ARROW)) {
    downPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_DOWN_ARROW)) {
  if (event.isKeyDown(KeyEvent.VK_RIGHT_ARROW)) {
    rightPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_RIGHT_ARROW)) {
  if (event.isKeyDown(KeyEvent.VK_LEFT_ARROW)) {

代码示例来源:origin: com.harium.propan/propan

@Override
public void updateKeyboard(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_W)) {
    forwardPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_W)) {
  if (event.isKeyDown(KeyEvent.VK_S)) {
    backwardPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_S)) {
  if (event.isKeyDown(KeyEvent.VK_E)) {
    liftPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_E)) {
  if (event.isKeyDown(KeyEvent.VK_Q)) {
    divePressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_Q)) {
  if (event.isKeyDown(KeyEvent.VK_D)) {
    strafeRightPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_D)) {
  if (event.isKeyDown(KeyEvent.VK_A)) {
    strafeLeftPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_A)) {
  if (event.isKeyDown(KeyEvent.VK_UP_ARROW)) {
    upPressed = true;
  } else if (event.isKeyUp(KeyEvent.VK_UP_ARROW)) {

代码示例来源:origin: com.harium/etyl

private void updateKeyboardEvents(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_ALT_RIGHT) || event.isKeyDown(KeyEvent.VK_ALT_LEFT)) {
    alt = true;
  } else if (event.isKeyUp(KeyEvent.VK_ALT_RIGHT) || event.isKeyUp(KeyEvent.VK_ALT_LEFT)) {
    alt = false;
  }
  if (event.isKeyDown(KeyEvent.VK_ENTER)) {
    enter = true;
  } else if (event.isKeyUp(KeyEvent.VK_ENTER)) {
    enter = false;
  }
  if (event.isKeyDown(KeyEvent.VK_ESC)) {
    esc = true;
  } else if (event.isKeyUp(KeyEvent.VK_ESC)) {
    esc = false;
  }
  if (alt && enter) {
    alt = false;
    enter = false;
    if (!isFullScreenEnable()) {
      enableFullScreen = true;
    }
  }
  if (esc) {
    esc = false;
    if (isFullScreenEnable()) {
      disableFullScreen = true;
    }
  }
}

代码示例来源:origin: com.harium.etyl/etyl

private void updateKeyboardEvents(KeyEvent event) {
  if (event.isKeyDown(KeyEvent.VK_ALT_RIGHT) || event.isKeyDown(KeyEvent.VK_ALT_LEFT)) {
    alt = true;
  } else if (event.isKeyUp(KeyEvent.VK_ALT_RIGHT) || event.isKeyUp(KeyEvent.VK_ALT_LEFT)) {
    alt = false;
  }
  if (event.isKeyDown(KeyEvent.VK_ENTER)) {
    enter = true;
  } else if (event.isKeyUp(KeyEvent.VK_ENTER)) {
    enter = false;
  }
  if (event.isKeyDown(KeyEvent.VK_ESC)) {
    esc = true;
  } else if (event.isKeyUp(KeyEvent.VK_ESC)) {
    esc = false;
  }
  if (alt && enter) {
    alt = false;
    enter = false;
    if (allowFullscreen && !isFullScreenEnable()) {
      enableFullScreen = true;
    }
  }
  if (esc) {
    esc = false;
    if (isFullScreenEnable()) {
      disableFullScreen = true;
    }
  }
}

代码示例来源:origin: com.harium/etyl

if (event.isKeyDown(KeyEvent.VK_UP_ARROW)) {
  if (selectedIndex != UNKNOWN) {
    selected.offsetY(-speed());
    refresh();
} else if (event.isKeyDown(KeyEvent.VK_DOWN_ARROW)) {
  if (selectedIndex != UNKNOWN) {
    selected.offsetY(+speed());
if (event.isKeyDown(KeyEvent.VK_LEFT_ARROW)) {
  if (selectedIndex != UNKNOWN) {
    selected.offsetX(-speed());
    refresh();
} else if (event.isKeyDown(KeyEvent.VK_RIGHT_ARROW)) {
  if (selectedIndex != UNKNOWN) {
    selected.offsetX(+speed());

代码示例来源:origin: com.harium.etyl/etyl

if (event.isKeyDown(KeyEvent.VK_NUMPAD_LEFT_ARROW)) {
} else if (event.isKeyDown(KeyEvent.VK_NUMPAD_RIGHT_ARROW)) {
if (event.isKeyDown(KeyEvent.VK_NUMPAD_UP_ARROW)) {
} else if (event.isKeyDown(KeyEvent.VK_NUMPAD_DOWN_ARROW)) {
if (event.isKeyDown(KeyEvent.VK_NUMPAD_INS)) {
  getMouse().addEvent(new PointerEvent(MouseEvent.MOUSE_BUTTON_LEFT, PointerState.PRESSED));
} else if (event.isKeyUp(KeyEvent.VK_NUMPAD_INS)) {
if (event.isKeyDown(KeyEvent.VK_NUMPAD_DEL)) {
  getMouse().addEvent(new PointerEvent(MouseEvent.MOUSE_BUTTON_RIGHT, PointerState.PRESSED));
} else if (event.isKeyUp(KeyEvent.VK_NUMPAD_DEL)) {

代码示例来源:origin: com.harium/etyl

if (event.isKeyDown(KeyEvent.VK_NUMPAD_LEFT_ARROW)) {
} else if (event.isKeyDown(KeyEvent.VK_NUMPAD_RIGHT_ARROW)) {
if (event.isKeyDown(KeyEvent.VK_NUMPAD_UP_ARROW)) {
} else if (event.isKeyDown(KeyEvent.VK_NUMPAD_DOWN_ARROW)) {
if (event.isKeyDown(KeyEvent.VK_NUMPAD_INS)) {
  getMouse().addEvent(new PointerEvent(MouseEvent.MOUSE_BUTTON_LEFT, PointerState.PRESSED));
} else if (event.isKeyUp(KeyEvent.VK_NUMPAD_INS)) {
if (event.isKeyDown(KeyEvent.VK_NUMPAD_DEL)) {
  getMouse().addEvent(new PointerEvent(MouseEvent.MOUSE_BUTTON_RIGHT, PointerState.PRESSED));
} else if (event.isKeyUp(KeyEvent.VK_NUMPAD_DEL)) {

相关文章