Example #1
0
  /**
   * Paint this component.
   *
   * @param g the Graphics object to use to render this component
   */
  public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    super.paintComponent(g2);
    if (grid == null) return;

    Insets insets = getInsets();
    g2.setColor(backgroundColor);
    g2.fillRect(
        insets.left, insets.top, numCols * (cellSize + 1) + 1, numRows * (cellSize + 1) + 1);
    BufferedImage img = null;

    try {
      img = ImageIO.read(new File("Thor_GIFs\\ice.png"));
    } catch (IOException e) {
    }
    g2.drawImage(
        img,
        insets.left,
        insets.top,
        numCols * (cellSize + 1) + 1,
        numRows * (cellSize + 1) + 1,
        0,
        0,
        img.getWidth(),
        img.getHeight(),
        null);
    drawWatermark(g2);
    // drawGridlines(g2);
    drawOccupants(g2);
    drawCurrentLocation(g2);
  }