Simulacion de Pulsar Tecla

David
08 de Enero del 2004
Como podria simular el uso de una tecla con un comando de java? es decir con el comando decirle que me simule el pulsar la tecla enter.

Zurdo
08 de Enero del 2004
uhhhhhhhh yo tb quiero saber, decimeeeeee

jdcl
08 de Enero del 2004
pruebe con

getKeyStroke public static javax.swing.KeyStroke getKeyStroke(java.lang.String s)Parses a string and returns a KeyStroke. The string must have the following syntax: <modifiers>* (<typedID> | <pressedReleasedID>)
modifiers := shift | control | ctrl | meta | alt | button1 | button2 | button3
typedID := typed <typedKey>
typedKey := string of length 1 giving Unicode character.
pressedReleasedID := (pressed | released) key
key := KeyEvent key code name, i.e. the name following "VK_".
If typed, pressed or released is not specified, pressed is assumed. Here are some examples: "INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0);
"control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
"alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
"alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
"typed a" => getKeyStroke('a');
In order to maintain backward-compatibility, specifying a null String, or a String which is formatted incorrectly, returns null.Parameters:s - a String formatted as described aboveReturns:a KeyStroke object for that String, or null if the specified String is null, or is formatted incorrectly