public void paintComponent(Graphics g) { super.paintComponent(g); drawBorders(this.cellSize, this.gapSize, g); List<Cell> solution = maze.getSolution(); for (List<Cell> row : this.maze.getCells()) { for (Cell cell : row) { Color color = Color.WHITE; if (cell.isVisited()) { color = Color.LIGHT_GRAY; } if (solution != null && solution.contains(cell)) { color = Color.YELLOW; } if (cell.equals(this.maze.getStart())) { color = Color.GREEN; } if (cell.equals(this.maze.getEnd())) { color = Color.RED; } drawCell(cell, this.cellSize, this.gapSize, g, color); } } for (Wall wall : this.maze.getWalls()) { drawWall(wall, this.cellSize, this.gapSize, g); } }