private void drawStoreBG(Graphics g)
        //  PRE:  g must be initialized.
        //  POST: Draws the background associated with store.
      {
    switch (store) // draw background based on value of store.
    {
      case 0:
        Drawing.drawGradient(
            g, new Color(180, 80, 80), new Color(20, 0, 0), 0, 0, getWidth(), getHeight() / 2);
        Drawing.drawGradient(
            g,
            new Color(20, 0, 0),
            new Color(180, 80, 80),
            0,
            getHeight() / 2,
            getWidth(),
            getHeight() / 2 + 1);
        break;

      case 1:
        Drawing.drawGradient(
            g, new Color(80, 180, 80), new Color(0, 20, 0), 0, 0, getWidth(), getHeight());
        break;

      case 2:
        Drawing.drawGradient(
            g, new Color(230, 170, 50), new Color(60, 20, 0), 0, 0, getWidth(), getHeight());
        break;

      case 3:
        Drawing.drawGradient(
            g, new Color(120, 120, 120), new Color(20, 20, 20), 0, 0, getWidth(), getHeight());
        break;

      default:
        Drawing.drawGradient(
            g, new Color(80, 80, 180), new Color(0, 0, 20), 0, 0, getWidth(), getHeight());
    }
  }
  private void drawInventory(Graphics g)
        //  PRE:  g must be initialized.
        //  POST: Draws the inventory of the store if mode == 0, else draws the players inventory.
        //        If an item is selected, its border is highlighted white.
      {
    Graphics2D g2; // Graphics 2D object to allow for different brush stroke widths.
    Color start; // The start color for the inventory window gradient.
    Color end; // The end color for the inventory window gradient.
    int x1; // Upper-left x coordinate.
    int y1; // Upper-left y coordinate.
    int x2; // Bottom-right x coordinate.
    int y2; // Bottom-right y coordinate.
    int width; // Width of the inventory box.
    int height; // Height of the inventory box.
    int itemHeight; // The height of an item box.
    int itemY; // The y coordinate of the item.
    Item currentItem; // Item to store the current item

    g2 = (Graphics2D) g;
    start = new Color(120, 120, 220);
    end = new Color(50, 50, 150);

    x1 = inventoryPos[0].getScaledX();
    y1 = inventoryPos[0].getScaledY();
    x2 = inventoryPos[1].getScaledX();
    y2 = inventoryPos[1].getScaledY();
    width = x2 - x1;
    height = y2 - y1;

    while (height % ITEMSPERPAGE != 0) // ensure that the item boxes do not fall short of the window
    {
      height = ++y2 - y1;
    }

    itemHeight = height / ITEMSPERPAGE;

    Drawing.drawGradient(g2, start, end, x1, y1, width, height / 2);
    Drawing.drawGradient(g2, end, start, x1, y1 + height / 2, width, height / 2);

    g2.setColor(Color.BLACK);
    g2.setStroke(new BasicStroke(3));
    g2.drawRect(--x1, --y1, ++width, height);
    g2.setColor(Color.WHITE);

    switch (store) // Chooses the current store
    {
      case 0:
        connectItems(getUserItems("Weapon", orderToSort));
        break;
      case 1:
        connectItems(getUserItems("ArmorSmith", orderToSort));
        break;
      case 2:
        connectItems(getUserItems("Accessory", orderToSort));
        break;
      case 3:
        connectItems(getUserItems("General", orderToSort));
        break;
    }

    if (mode) // Sets mode to true for user inventory and displays
    {
      connectItems(getUserItems("Player", orderToSort));
    }

    int count = 0;
    // count = currentPage * ITEMSPERPAGE ;

    try // Try loading 10 items per page
    {

      currentItem = null;
      count = currentPage * ITEMSPERPAGE;
      for (int i = 0; i < ITEMSPERPAGE; i++) // draw each item into the window
      {
        if (i > itemsArray.length - 1) // Check if i excceds the array size
        {
          return;
        }
        itemY = y1 + (itemHeight) * i;

        currentItem = itemsArray[count];

        if (itemSelected == i) // if the item was selected, highlight it
        {
          g2.drawRect(x1, itemY, width, itemHeight);
        }

        drawItem(g2, i, currentItem);

        count++;
      }

    } catch (Exception e) // Catch generic exception and print it out
    {
      System.err.println(e.toString());
      System.err.println("Oh no, not like this...");
    }
  }