Ejemplo n.º 1
0
 private void drawCell(Cell cell, int cellSize, int gapSize, Graphics g, Color color) {
   g.setColor(color);
   int x1 = cell.getX() * (cellSize + gapSize) + gapSize;
   int y1 = cell.getY() * (cellSize + gapSize) + gapSize;
   int width = cellSize;
   int height = cellSize;
   g.fillRect(x1, y1, width, height);
 }
Ejemplo n.º 2
0
 private void drawWall(Wall wall, int cellSize, int gapSize, Graphics g) {
   g.setColor(Color.BLACK);
   Cell cell1 = wall.getCell1();
   Cell cell2 = wall.getCell2();
   if (cell1.getX() == cell2.getX()) {
     if (cell1.getY() > cell2.getY()) {
       drawBottomWall(cell1.getX(), cell1.getY(), cellSize, gapSize, g);
     } else {
       drawTopWall(cell1.getX(), cell1.getY(), cellSize, gapSize, g);
     }
   } else {
     if (cell1.getX() < cell2.getX()) {
       drawRightWall(cell1.getX(), cell1.getY(), cellSize, gapSize, g);
     } else {
       drawLeftWall(cell1.getX(), cell1.getY(), cellSize, gapSize, g);
     }
   }
 }