code: public static void doAction(JTextField textField){
          String command = null;
          if(textField.getAction()!=null)
              command = (String)textField.getAction().getValue(Action.ACTION_COMMAND_KEY);
          ActionEvent event = null;
          
          for(ActionListener listener: textField.getActionListeners()){
              if(event==null)
                  event = new ActionEvent(textField, ActionEvent.ACTION_PERFORMED, command, System.currentTimeMillis(), 0);
              listener.actionPerformed(event);
          }
      }
docs: Programmatically perform action on textfield.This does the same
  thing as if the user had pressed enter key in textfield.
  
  @param textField textField on which action to be preformed