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); }
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); } } }