예제 #1
0
  public void updateGridBorder() {

    Controller_ForestArea.updatePropWithTab();

    for (int i = 0; i < Controller_ForestArea.getHeight(); i++) {

      for (int j = 0; j < Controller_ForestArea.getWidth(); j++) {
        if (View_ForestArea.isMap_border()) {
          this.Cells[i][j].setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
        } else {
          this.Cells[i][j].setBorder(null);
        }
      }
    }
  }
예제 #2
0
  public void createGrid() {

    this.removeAll();

    this.Cells = new View_Cell[Controller_ForestArea.getHeight()][Controller_ForestArea.getWidth()];
    Controller_ForestArea.updatePropWithTab();

    for (int i = 0; i < Controller_ForestArea.getHeight(); i++) {
      this.gbc.gridy = i;

      for (int j = 0; j < Controller_ForestArea.getWidth(); j++) {
        this.gbc.gridx = j;

        switch (Controller_ForestArea.getForestAreaTab()[i][j]) {
          case 0:
            this.Cells[i][j] = new View_Cell(i, j, Enum_Cell.EMPTY.getColor());
            break;
          case 1:
            this.Cells[i][j] = new View_Cell(i, j, Enum_Cell.YOUNG_PLANT.getColor());
            break;
          case 2:
            this.Cells[i][j] = new View_Cell(i, j, Enum_Cell.SMALL_TREE.getColor());
            break;
          case 3:
            this.Cells[i][j] = new View_Cell(i, j, Enum_Cell.ADULT_TREE.getColor());
            break;
          case 4:
            this.Cells[i][j] = new View_Cell(i, j, Enum_Cell.FIRE.getColor());
            break;
          case 5:
            this.Cells[i][j] = new View_Cell(i, j, Enum_Cell.INFECT.getColor());
            break;
          case 6:
            this.Cells[i][j] = new View_Cell(i, j, Enum_Cell.ASH.getColor());
            break;
        }

        this.add(this.Cells[i][j], this.gbc);
      }
    }
    this.revalidate();
    this.repaint();
  }
예제 #3
0
  public void updateGridColors() {

    Controller_ForestArea.updatePropWithTab();

    for (int i = 0; i < Controller_ForestArea.getHeight(); i++) {

      for (int j = 0; j < Controller_ForestArea.getWidth(); j++) {

        switch (Controller_ForestArea.getForestAreaTab()[i][j]) {
          case 0:
            this.Cells[i][j].setBackground(Enum_Cell.EMPTY.getColor());
            break;
          case 1:
            this.Cells[i][j].setBackground(Enum_Cell.YOUNG_PLANT.getColor());
            break;
          case 2:
            this.Cells[i][j].setBackground(Enum_Cell.SMALL_TREE.getColor());
            break;
          case 3:
            this.Cells[i][j].setBackground(Enum_Cell.ADULT_TREE.getColor());
            break;
          case 4:
            this.Cells[i][j].setBackground(Enum_Cell.FIRE.getColor());
            break;
          case 5:
            this.Cells[i][j].setBackground(Enum_Cell.INFECT.getColor());
            break;
          case 6:
            this.Cells[i][j].setBackground(Enum_Cell.ASH.getColor());
            break;
        }
      }
    }
    // this.revalidate();

  }