本文整理汇总了Java中javafx.scene.input.KeyCode.UNDEFINED属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCode.UNDEFINED属性的具体用法?Java KeyCode.UNDEFINED怎么用?Java KeyCode.UNDEFINED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.scene.input.KeyCode
的用法示例。
在下文中一共展示了KeyCode.UNDEFINED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchKeyEvent
@SuppressWarnings("deprecation") private void dispatchKeyEvent(final Node node, JavaAgentKeys keyToPress,
EventType<KeyEvent> eventType, char c) {
ensureVisible(node);
if (keyToPress == null) {
KeyboardMap kbMap = new KeyboardMap(c);
KeyCode keyCode = KeyCode.getKeyCode((kbMap.getChar() + "").toUpperCase());
if (eventType.getName().equals("KEY_TYPED")) {
keyCode = KeyCode.UNDEFINED;
}
int modifiersEx = deviceState.getModifierEx();
char char1 = kbMap.getChar();
if (modifiersEx == 0) {
modifiersEx = kbMap.getModifiersEx();
dispatchEvent(new KeyEvent(eventType, char1 + "", char1 + "", keyCode, deviceState.isShiftPressed(),
deviceState.isCtrlPressed(), deviceState.isAltPressed(), deviceState.isMetaPressed()), node);
} else {
dispatchEvent(new KeyEvent(eventType, char1 + "", char1 + "", keyCode, deviceState.isShiftPressed(),
deviceState.isCtrlPressed(), deviceState.isAltPressed(), deviceState.isMetaPressed()), node);
}
return;
}
final KeysMap keysMap = KeysMap.findMap(keyToPress);
if (keysMap == null) {
return;
}
deviceState.toggleKeyState(keyToPress);
dispatchEvent(new KeyEvent(eventType, KeyCode.UNDEFINED.impl_getChar(), KeyCode.UNDEFINED.impl_getChar(), keysMap.getCode(),
deviceState.isShiftPressed(), deviceState.isCtrlPressed(), deviceState.isAltPressed(), deviceState.isMetaPressed()),
node);
}
示例2: dummyKeyEvent
@Contract(pure = true)
public static KeyEvent dummyKeyEvent(final EventType<KeyEvent> eventType) {
return new KeyEvent(
eventType,
KeyEvent.CHAR_UNDEFINED,
"dummy character",
KeyCode.UNDEFINED,
false,
false,
false,
false
);
}