protected Step createSelection(JComboBox combo, int index) {
   Step step = null;
   if (combo != null && index != -1) {
     ComponentReference cr = getResolver().addComponent(combo);
     String value = tester.getValueAsString(combo, list, combo.getItemAt(index), index);
     if (value == null) {
       step =
           new Action(
               getResolver(),
               null,
               "actionSelectIndex",
               new String[] {cr.getID(), String.valueOf(index)},
               javax.swing.JComboBox.class);
     } else {
       step =
           new Action(
               getResolver(),
               null,
               "actionSelectItem",
               new String[] {cr.getID(), value},
               javax.swing.JComboBox.class);
     }
   }
   return step;
 }
 protected Step createResize(Window window, Dimension size) {
   Step step = null;
   if (((Dialog) window).isResizable()) {
     ComponentReference ref = getResolver().addComponent(window);
     step =
         new Action(
             getResolver(),
             null,
             "actionResize",
             new String[] {
               ref.getID(), String.valueOf(size.width), String.valueOf(size.height),
             },
             Dialog.class);
   }
   return step;
 }
  /**
   * Create one or more steps corresponding to what was done to the file dialog. If the directory is
   * non-null, the directory was changed. If the file is non-null, the file was accepted.
   */
  protected Step createFileDialogEvents(FileDialog d, String oldDir, String oldFile) {
    ComponentReference ref = getResolver().addComponent(d);
    String file = d.getFile();
    boolean accepted = file != null;
    boolean fileChanged = accepted && !file.equals(oldFile);
    String dir = d.getDirectory();
    boolean dirChanged = dir != oldDir && (dir == null || !dir.equals(oldDir));

    String desc = d.getMode() == FileDialog.SAVE ? "Save File" : "Load File";
    if (accepted) desc += " (" + file + ")";
    else desc += " (canceled)";
    Sequence seq = new Sequence(getResolver(), desc);
    if (dirChanged) {
      seq.addStep(
          new Action(
              getResolver(),
              null,
              "actionSetDirectory",
              new String[] {ref.getID(), dir},
              FileDialog.class));
    }
    if (accepted) {
      Step accept =
          new Action(
              getResolver(), null, "actionAccept", new String[] {ref.getID()}, FileDialog.class);
      if (fileChanged) {
        seq.addStep(
            new Action(
                getResolver(),
                null,
                "actionSetFile",
                new String[] {ref.getID(), file},
                FileDialog.class));
        seq.addStep(accept);
      } else {
        return accept;
      }
    } else {
      Step cancel =
          new Action(
              getResolver(), null, "actionCancel", new String[] {ref.getID()}, FileDialog.class);
      if (dirChanged) seq.addStep(cancel);
      else return cancel;
    }
    return seq;
  }