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:
1 parent
1e934b05e6
commit
c0afbe104c
6 files changed
+57
-2
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package ui;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import model.MazeAppModel;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class DrawShortestPathMenuItem extends JMenuItem
|
||||
implements ActionListener {
|
||||
|
||||
private final MazeApp mazeApp;
|
||||
|
||||
public DrawShortestPathMenuItem(MazeApp mazeApp) {
|
||||
|
||||
super("Draw shortest path");
|
||||
this.mazeApp = mazeApp;
|
||||
addActionListener(this);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
mazeApp.drawShortestPath();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user