Ejemplo n.º 1
0
    /** Draw the shapes in the model */
    public void paintComponent(Graphics g) {
      super.paintComponent(g); // clears drawing area

      // draw the background image if one exists
      if (room.hasBackgroundImage()) {
        g.drawImage(room.getBackgroundImage(), 0, 0, this.getWidth(), this.getHeight(), this);
      } else {
        setBackground(room.getBackgroundColor());
      }

      g.setColor(Color.WHITE);
      g.drawString("" + room.getRoomNumber(), size / 2, size / 2);

      if (room == maze.getCurrentRoom()) {
        maze.getPlayer().drawInCenter(g, this.getBounds());
      }
    }