javafx.scene.input.KeyCode.impl_getCode()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(211)

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

KeyCode.impl_getCode介绍

暂无

代码示例

代码示例来源:origin: org.testfx/testfx-internal-java8

@SuppressWarnings("deprecated")
public static int convertToKeyCodeId(KeyCode keyCode) {
  return keyCode.impl_getCode();
}

代码示例来源:origin: org.loadui/testFx

@SuppressWarnings("deprecation")
@Override
public void pressNoWait( KeyCode key )
{
  robot.keyPress( key.impl_getCode() );
}

代码示例来源:origin: org.loadui/testFx

@SuppressWarnings("deprecation")
@Override
public void releaseNoWait( KeyCode key )
{
  robot.keyRelease( key.impl_getCode() );
}

代码示例来源:origin: org.loadui/testFx

@SuppressWarnings("deprecation")
  public static KeyCode findKeyCode(char character) {
    if (KEY_CODES.containsKey(character)) {
      return KEY_CODES.get(character);
    }

    KeyCode keyCode = KeyCode.getKeyCode(String.valueOf(Character.toUpperCase(character)));
    if (keyCode != null) {
      return keyCode;
    }

    for (KeyCode code : KeyCode.values()) {
      if ((char) code.impl_getCode() == character) {
        return code;
      }
    }

    throw new IllegalArgumentException("No KeyCode found for character: " + character);
  }
}

代码示例来源:origin: org.testfx/testfx-legacy

@SuppressWarnings("deprecation")
  public static KeyCode findKeyCode(char character) {
    if (KEY_CODES.containsKey(character)) {
      return KEY_CODES.get(character);
    }

    KeyCode keyCode = KeyCode.getKeyCode(String.valueOf(Character.toUpperCase(character)));
    if (keyCode != null) {
      return keyCode;
    }

    for (KeyCode code : KeyCode.values()) {
      if ((char) code.impl_getCode() == character) {
        return code;
      }
    }

    throw new IllegalArgumentException("No KeyCode found for character: " + character);
  }
}

代码示例来源:origin: org.loadui/testFx

@SuppressWarnings("deprecation")
@Override
public void press( KeyCode key )
{
  robot.keyPress( key.impl_getCode() );
  FXTestUtils.awaitEvents();
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx

@SuppressWarnings("deprecation")
static final int convertEventToModifiedAccelerator(final KeyEvent event) {
  int modifiers = getStateMask(event) & FxKeyLookup.MODIFIER_MASK;
  return modifiers + event.getCode().impl_getCode();
  // char character = topKey(event);
  // return modifiers + toUpperCase(character);
}

代码示例来源:origin: stackoverflow.com

public class KeysMapper {
 private static HashMap<Character, Integer> charMap = new HashMap<Character, Integer>();
 static {
   for (KeyCode keyCode : KeyCode.values()) {
     if (keyCode.impl_getCode() >= 65 && keyCode.impl_getCode() <= 90){
       charMap.put(keyCode.getName().toLowerCase().toCharArray()[0], keyCode.impl_getCode());
     }
     else{
       charMap.put(keyCode.getName().toLowerCase().toCharArray()[0], keyCode.impl_getCode());
     }
   }
 }
 public static Key charToKey(char c){
   if(c>=65 && c<=90){
     return new Key(charMap.get(c), true);
   } else {
     return new Key(charMap.get(c), false);
   }
 }
 public static List<Key> stringToKeys(String text){
   List<Key> keys = new ArrayList<Key>();
   for (char c : text.toCharArray()) {
     keys.add(charToKey(c));
   }
   return keys;
 }

代码示例来源:origin: org.loadui/testFx

@SuppressWarnings("deprecation")
@Override
public void release( KeyCode key )
{
  robot.keyRelease( key.impl_getCode() );
  FXTestUtils.awaitEvents();
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx

@SuppressWarnings("deprecation")
static int convertEventToUnmodifiedAccelerator(KeyEvent event) {
  int modifiers = getStateMask(event) & FxKeyLookup.MODIFIER_MASK;
  return modifiers + event.getCode().impl_getCode();
}

代码示例来源:origin: org.processing/core

@SuppressWarnings("deprecation")
private int getKeyCode(KeyEvent fxEvent) {
 if (fxEvent.getEventType() == KeyEvent.KEY_TYPED) {
  return 0;
 }
 KeyCode kc = fxEvent.getCode();
 switch (kc) {
  case ALT_GRAPH:
   return PConstants.ALT;
  default:
   break;
 }
 return kc.impl_getCode();
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx

@SuppressWarnings("deprecation")
static final int convertEventToUnshiftedModifiedAccelerator(final KeyEvent event) {
  // Disregard alphabetic key strokes.
  if (Character.isLetter(event.getCharacter().charAt(0))) {
    return convertEventToUnmodifiedAccelerator(event);
  }
  int modifiers = getStateMask(event) & (FxKeyLookup.MODIFIER_MASK ^ FxKeyLookup.SHIFT);
  return modifiers + event.getCode().impl_getCode();
  // char character = topKey(event);
  // return modifiers + toUpperCase(character);
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.workbench.fx

final Integer code = Integer.valueOf(KeyCode.DOWN.impl_getCode());
this.naturalKeyTable.put(ARROW_DOWN_NAME, code);
this.nameTable.put(code, ARROW_DOWN_NAME);
final Integer code = Integer.valueOf(KeyCode.LEFT.impl_getCode());
this.naturalKeyTable.put(ARROW_LEFT_NAME, code);
this.nameTable.put(code, ARROW_LEFT_NAME);
final Integer code = Integer.valueOf(KeyCode.RIGHT.impl_getCode());
this.naturalKeyTable.put(ARROW_RIGHT_NAME, code);
this.nameTable.put(code, ARROW_RIGHT_NAME);
final Integer code = Integer.valueOf(KeyCode.UP.impl_getCode());
this.naturalKeyTable.put(ARROW_UP_NAME, code);
this.nameTable.put(code, ARROW_UP_NAME);
final Integer code = Integer.valueOf(KeyCode.BACK_SPACE.impl_getCode());
this.naturalKeyTable.put(BS_NAME, code);
this.nameTable.put(code, BS_NAME);
final Integer code = Integer.valueOf(KeyCode.CAPS.impl_getCode());
this.naturalKeyTable.put(CAPS_LOCK_NAME, code);
this.nameTable.put(code, CAPS_LOCK_NAME);
final Integer code = Integer.valueOf(KeyCode.ENTER.impl_getCode());
this.naturalKeyTable.put(CR_NAME, code);
this.nameTable.put(code, CR_NAME);
final Integer code = Integer.valueOf(KeyCode.DELETE.impl_getCode());

相关文章