【发布时间】:2014-06-17 08:22:59
【问题描述】:
我想让我的 JFX 应用程序模拟箭头键按下(当它们在 TextField 中注册时),但我不知道如何发送字符串或字节以外的任何内容。
我在想象这样的事情:
static EventHandler<KeyEvent> KEY() {
E = new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent ke) {
if (ke.getCode().equals(KeyCode.UP)) {
try {
//someObject.SimulateKeyPress(KeyCode.UP);
//OR
//coolObject.SendKey((char)KEY_UPKEY));
} catch (Exception ex) {
//Teleport goats
}
}
}
};
return E;
}
【问题讨论】: