title: ActionMap / InputMap to make JTextArea display "this text" when F2 is pressed
body: <p>I've been trying to make a JTextArea display a certain String when F2 is pressed in a certain TextField, with no success as yet. Any help much appreciated.</p>
  
  <p>My code may reveal how little programming experience I have:</p>
  
  <pre><code>final String ACTION_KEY = "this text";
  
  public void actionPerformed(ActionEvent actionEvent) {
  
                  JTextField source = (JTextField) actionEvent.getSource();
  
                  System.out.println("Activated: " + source.getText());
  
                  textAreaInstructions.setText("this text");
  
                }
              };
  
  
              KeyStroke F2 = KeyStroke.getKeyStroke("F2");
              InputMap inputMap = timeStep.getInputMap();
              inputMap.put(F2, ACTION_KEY);
              ActionMap actionMap = timeStep.getActionMap();          
              actionMap.put(ACTION_KEY, actionListener);
  </code></pre>
  
  <p>EDIT: I'm now trying this code instead:</p>
  
  <pre><code>InputMap inputMap = timeStep.getInputMap();
          Object actionSubmit = inputMap.get(KeyStroke.getKeyStroke("ENTER"));
          Object actionSubmitSp = inputMap.get(KeyStroke.getKeyStroke("SPACE"));
          System.out.println("actionSubmit for space = " + actionSubmitSp);
          ActionMap actionMap = timeStep.getActionMap();
          Action action = actionMap.get(actionSubmit);
          System.out.println("actionSubmit = " + actionSubmit);
          timeStep.getInputMap().put(KeyStroke.getKeyStroke("SPACE"),
                  actionSubmit);
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>This prints </p>
  
  <pre><code>actionSubmit for space = null
  actionSubmit = notify-field-accept
  </code></pre>
  
  <p>Is this any use?</p>