Add menu button to draw the shortest path

ui:
* Add methods to draw the shortest path from MazeApp, WindowPanel and
  MazeDrawing
* Add a Maze menu with a button to draw the shortest path from departure
  to arrival
This commit is contained in:
regar42 committed 2017-12-24 20:20:40 +01:00
1 parent 1e934b05e6
commit c0afbe104c
6 files changed
+57 -2

No files matched your search

+6 -2
View File
@@ -19,7 +19,7 @@ public class MazeDrawing extends JPanel {
this.mazeApp = mazeApp;
setBackground(Color.BLACK);
setPreferredSize(new Dimension(500,500)) ;
}
@Override
@@ -41,7 +41,7 @@ public class MazeDrawing extends JPanel {
}
}
public void paintShortestPath(Graphics2D g, int width, int height) {
private void paintShortestPath(Graphics2D g, int width, int height) {
g.setColor(Color.ORANGE);
int dimensionX = mazeApp.getMazeAppModel().getMaze().getDimensionX();
@@ -53,4 +53,8 @@ public class MazeDrawing extends JPanel {
g.fillOval(box.getX()*boxWidth, box.getY()*boxHeight, boxWidth, boxHeight);
}
}
public void paintShortestPath() {
paintShortestPath((Graphics2D) getGraphics(), getWidth(), getHeight());
}
}