// Assumption: alGamesInfo is set to a valid object and noOfGames = alGamesInfo.size().
  public void setSelectedGameIndex(int newGameIndex) {
    if ((newGameIndex < 1) || (newGameIndex > noOfGames - 2))
      // => Invalid game index passed.
      selGameIndex = 1; // reset
    else selGameIndex = newGameIndex;

    // FIXME: Handle case when alGamesInfo.get(%index%).getLogo() = null (when %id%.png is absent)
    // Create top blurred image.
    BufferedImage biTemp = alGamesInfo.get(selGameIndex - 1).getLogo();
    biTopBlurred =
        UIHelpers.EmptyCompatibleImage(
            biTemp.getWidth(), biTemp.getHeight(), biTemp.getColorModel().getTransparency());
    blurOp.filter(biTemp, biTopBlurred);
    biTopBlurred = blurOp.filter(biTopBlurred, null);
    biTopBlurred = blurOp.filter(biTopBlurred, null);

    // Create bottom blurred image.
    // TODO: NULL pointer exception occurs here is there are no
    // logo and screenshot images available for a game
    biTemp = alGamesInfo.get(selGameIndex + 1).getLogo();
    biBottomBlurred =
        UIHelpers.EmptyCompatibleImage(
            biTemp.getWidth(), biTemp.getHeight(), biTemp.getColorModel().getTransparency());
    blurOp.filter(biTemp, biBottomBlurred);
    biBottomBlurred = blurOp.filter(biBottomBlurred, null);
    biBottomBlurred = blurOp.filter(biBottomBlurred, null);
  }
  // Used by GamePadPanel constructor only
  private void PopulateGamesList(List<GamesListbox.GameStruct> alGamesInfo) {
    NodeList gameList = docGameXML.getElementsByTagName("game");
    Element elmGame;
    File logoImageFile;
    BufferedImage biLogo;
    int i;
    String id;
    int nGameFiles = 0;

    alGamesInfo.add(
        new GamesListbox.GameStruct(
            "",
            "Top Filler",
            UIHelpers.EmptyCompatibleImage(
                currTheme.getMonogramWidth(), currTheme.getMonogramHeight())));
    for (i = 0; i < gameList.getLength(); i++) {
      elmGame = (Element) gameList.item(i);
      id = elmGame.getAttribute("id");
      if (!id.isEmpty()) {
        File gamesDirectory = new File(romsFolder, id);
        if (gamesDirectory.isDirectory()) {
          // TODO: Need some more validation to determine if the game is installed
          // Need to check at least one complete set of files is installed in these folders
          // Checking every file will be time consuming as number of installed games increase.
          // Maybe just the number of files (as per number of <rom> nodes in the primary
          // fileset element), actual game load will validate the file.
          // Number of files equal to or more than the number of <rom> nodes is ok as it may have
          // additional copyright/readme files

          // TODO: Shouldn't we move this code to game Hashmap creation?
          NodeList elmGameFiles = elmGame.getElementsByTagName("fileset");
          int j;
          int nGameFilesets = elmGameFiles.getLength();
          for (j = 0; j < nGameFilesets; j++) {
            Element fileset;
            fileset = (Element) elmGameFiles.item(j);
            if (fileset.getAttribute("primary").equalsIgnoreCase("true")) {
              NodeList elmRomfiles = fileset.getElementsByTagName("rom");
              nGameFiles = elmRomfiles.getLength();
            }
          }

          int nFolderFiles = gamesDirectory.listFiles().length;
          if (nFolderFiles >= nGameFiles) {
            biLogo = null;
            logoImageFile = new File(monogramsPath, id + ".png");
            if (logoImageFile.isFile()) biLogo = UIHelpers.LoadBufferedImage(logoImageFile);
            else biLogo = UIHelpers.LoadBufferedImage(new File(monogramsPath, "nologo.png"));

            alGamesInfo.add(new GamesListbox.GameStruct(id, elmGame.getAttribute("name"), biLogo));
          }
        }
      }
    }
  }
  // Used only by LoadScreenshotImage() only
  private BufferedImage InstallHintScreenshot() {
    Font ft = new Font(Font.DIALOG, Font.PLAIN, 16);
    BufferedImage biHintScreenshot =
        UIHelpers.EmptyCompatibleImage(screenshotWidth, screenshotHeight);
    Graphics2D g2d = biHintScreenshot.createGraphics();

    g2d.setBackground(Color.WHITE);
    g2d.clearRect(0, 0, screenshotWidth, screenshotHeight);
    g2d.setFont(ft);
    g2d.setColor(Color.BLACK);
    g2d.drawString("Install Games", 15, 25);

    g2d.dispose();
    return biHintScreenshot;
  }
  // Used only by GamesListbox constructor
  private BufferedImage InstallHintMonogram() {
    Font ft = new Font(Font.DIALOG, Font.PLAIN, 16);
    BufferedImage biHintMonogram =
        UIHelpers.EmptyCompatibleImage(currTheme.getMonogramWidth(), currTheme.getMonogramHeight());
    Graphics2D g2d = biHintMonogram.createGraphics();

    g2d.setBackground(Color.WHITE);
    g2d.clearRect(0, 0, currTheme.getMonogramWidth(), currTheme.getMonogramHeight());
    g2d.setFont(ft);
    g2d.setColor(Color.BLACK);
    g2d.drawString("Install Games", 15, 25);

    g2d.dispose();
    return biHintMonogram;
  }