/** This method is called when the selection of one of the two combo boxes is changed. */
  public void actionPerformed(ActionEvent ev) {

    sequenceField.hidePopup();
    separationField.hidePopup();

    try {
      if (ev.getSource() == sequenceField) {
        Animation listValue = sequenceField.getValue();
        Animation tileValue = tilePattern.getAnimation();
        if (listValue != tileValue) {
          // the tile pattern's animation sequence has changed
          tilePattern.setAnimation(listValue);
        }
      } else {
        AnimationSeparation listValue = separationField.getValue();
        AnimationSeparation tileValue = tilePattern.getAnimationSeparation();
        if (listValue != tileValue) {
          // the direction of the animation separation has changed
          tilePattern.setAnimationSeparation(listValue);
        }
      }
    } catch (TilesetException ex) {
      JOptionPane.showMessageDialog(null, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
      update(tilePattern);
    }
  }