/**
   * Get the portrait for the given pilot.
   *
   * @return The <code>Image</code> of the pilot's portrait. This value will be <code>null</code> if
   *     no portrait was selected or if there was an error loading it.
   */
  public Image getPortrait(Crew pilot) {

    String category = pilot.getPortraitCategory();
    String file = pilot.getPortraitFileName();

    // Return a null if the player has selected no portrait file.
    if ((null == category) || (null == file) || (null == portraits)) {
      return null;
    }

    if (Crew.PORTRAIT_NONE.equals(file)) {
      file = "default.gif"; // $NON-NLS-1$
    }

    if (Crew.ROOT_PORTRAIT.equals(category)) {
      category = "";
    }

    // Try to get the player's portrait file.
    Image portrait = null;
    try {
      portrait = (Image) portraits.getItem(category, file);
      if (null == portrait) {
        // the image could not be found so switch to default one
        category = "";
        file = "default.gif";
        portrait = (Image) portraits.getItem(category, file);
      }
      // make sure no images are longer than 72 pixels
      if (null != portrait) {
        portrait = portrait.getScaledInstance(-1, 72, Image.SCALE_DEFAULT);
      }
    } catch (Exception err) {
      err.printStackTrace();
    }
    return portrait;
  }