Index: trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java
===================================================================
--- trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java	(revision 1689)
+++ trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java	(revision 1691)
@@ -32,4 +32,5 @@
 import de.ugoe.cs.autoquest.eventcore.Event;
 import de.ugoe.cs.autoquest.eventcore.gui.*;
+import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey;
 import de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement;
 import de.ugoe.cs.util.console.Console;
@@ -207,4 +208,10 @@
                 else if (event.getType() instanceof KeyboardFocusChange) {
                     writeFocusChangeEvent(writer, event);
+                }
+                else if (event.getType() instanceof KeyPressed) {
+                    // writeKeyEvent(writer, event, 401);
+                }
+                else if (event.getType() instanceof KeyReleased) {
+                    // writeKeyEvent(writer, event, 402);
                 }
             }
@@ -413,3 +420,47 @@
         }
     }
+
+    private void writeKeyEvent(BufferedWriter writer, Event event, int jacId) throws IOException {
+        KeyInteraction info = (KeyInteraction) event.getType();
+        JFCGUIElement target = (JFCGUIElement) event.getTarget();
+
+        //@formatter:off
+        writeLine(writer,
+            "<KeyEvent "
+            + "procTime=\"0\" "
+            + "duration=\"150\" "
+            + "source=\"" + target.getJacaretoHierarchy() + "\" "
+            + "class=\"" + target.getSpecification().getType() + "\" "
+            + "uuid=\"" + UUID.randomUUID() + "\" "
+            + "ID=\"" + jacId + "\" "
+            + "component=\"null\" "
+            + "root=\"" + target.getJacaretoRoot() + "\" "
+            + "xPos=\"0\" "
+            + "yPos=\"0\" "
+            + "width=\"0\" "
+            + "height=\"0\" "
+            + "when=\"" + event.getTimestamp() + "\" " 
+            + "isConsumed=\"false\">" 
+        );
+        writeLine(writer,
+            "<KeyInfo "
+            + "keyCode=\"" + getKeyCode(info.getKey()) + "\" "
+            + "keyChar=\"" + getKeyChar(info.getKey()) + "\" "
+            + "modifiers=\"0\" />"
+        );
+        
+        writeLine(writer, "</KeyEvent>");
+        
+        // TODO: keyevent structure part
+    }
+    
+    private String getKeyChar (VirtualKey key) {
+        // TODO
+        return "";
+    }
+    
+    private int getKeyCode (VirtualKey key) {
+        // TODO
+        return -1;
+    }
 }
Index: trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElement.java
===================================================================
--- trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElement.java	(revision 1689)
+++ trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElement.java	(revision 1691)
@@ -162,5 +162,6 @@
         // jacareto indices start at 1
         int jacIndex = getIndex() + 1;
-        // some class specific hacks
+
+        // FIXME: some class specific hacks
         if (name.equals("JFrame")) {
             jacIndex++;
@@ -168,4 +169,7 @@
         else if (name.equals("JLayeredPane")) {
             jacIndex--;
+        }
+        else if (name.equals("JTextField")) {
+            jacIndex = 1;
         }
 
