/**
   * This is where rendering starts. This method is called each frame, and the entire game
   * application is rendered here with the help of a number of helper methods.
   *
   * @param g The Graphics context for this panel.
   */
  @Override
  public void paintComponent(Graphics g) {

    try {
      // MAKE SURE WE HAVE EXCLUSIVE ACCESS TO THE GAME DATA
      game.beginUsingData();

      // CLEAR THE PANEL
      super.paintComponent(g);

      // RENDER THE BACKGROUND, WHICHEVER SCREEN WE'RE ON
      renderBackground(g);

      // Render these things if the game as has started.
      if (!dataModel.notStarted()) {

        //                RENDER THE CARS IF THE LEVEL HASN'T BEEN WON YET
        //               if (!dataModel.won())
        //                    renderCars(g);
        //
        //                RENDER THE GRAPH, INCLUDING THE ROADS AND NODES.
        //                renderGraph();
        //
        //                RENDER DIALOGS IF THERE ARE ANY.
        //                renderDialogs(g);
        //                //
        //                renderLevelName(g);

      }
      if (((PathXMiniGame) game).isCurrentScreenState(LEVEL_SELECT_SCREEN_STATE)) {
        renderMap(g);
        renderLevelSelectStats(g);
        updateLevelSprites();
      }

      // RENDER BUTTONS AND DECOR
      renderGUIControls(g);

      // renderStats(g);

    } finally {
      game.endUsingData();
    }
  }