This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JavaFX and the fly likes creating and firing keyevent from action event on textfield Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "creating and firing keyevent from action event on textfield" Watch "creating and firing keyevent from action event on textfield" New topic
Author

creating and firing keyevent from action event on textfield

Sabitha Somesula
Greenhorn

Joined: Apr 08, 2013
Posts: 1
My virtual keyboard have buttons to represent keys in keyboard. On button pressed action event is generated. To type some text in text field using virtual key board , changed all action events of each button pressed to key events and doing fireevent on textfield. But no text is seen in textfield. Not understanding what's happening with firevent. When printing keyevent code getting right code.

public void handle(ActionEvent event) {
textField.requestFocus();

KeyEvent keyEvent = KeyEvent.impl_keyEvent(textField, KeyCode.valueOf(name).impl_getChar(), name, KeyCode.valueOf(name).impl_getCode(), false, false, false, false, new EventType<KeyEvent>());

KeyCode code = keyEvent.getCode();
System.out.println("code : " + code);

textField.fireEvent(keyEvent);
keyEvent.consume();

}
 
 
subject: creating and firing keyevent from action event on textfield