File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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();

}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating and firing keyevent from action event on textfield