Add UI to the project #29

Manually merged
regar42 merged 45 commits from mvc into master 2018-01-03 11:03:09 +00:00
7 changed files with 24 additions and 13 deletions
Showing only changes of commit 892d7e6ff3 - Show all commits

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ public class MainTest {
mazeTest.saveToTextFile("data/labyOutput.txt");
new MazeApp(mazeTest);
new MazeApp();
}
+10
View File
@@ -1,6 +1,16 @@
package model;
import maze.Maze;
public class MazeAppModel {
private Maze maze = new Maze("data/labyrinthe.txt");
public void setMaze(Maze maze) {
this.maze = maze;
}
public Maze getMaze() {
return maze;
}
}
+1 -1
View File
@@ -15,6 +15,6 @@ public abstract class DrawingBox extends JPanel {
this.color = color;
setBackground(color);
setPreferredSize(new Dimension(20,20));
setPreferredSize(new Dimension(40,40));
}
}
+2 -2
View File
@@ -13,10 +13,10 @@ public class DrawingPanelGrid extends JPanel {
private int dimensionX;
private int dimensionY;
public DrawingPanelGrid(MazeApp mazeApp, Maze maze) {
public DrawingPanelGrid(MazeApp mazeApp) {
this.mazeApp = mazeApp;
this.maze = maze;
this.maze = mazeApp.getMazeAppModel().getMaze();
this.dimensionX = maze.getDimensionX();
this.dimensionY = maze.getDimensionY();
+7 -4
View File
@@ -2,25 +2,28 @@ package ui;
import javax.swing.*;
import maze.Maze;
import model.MazeAppModel;
public class MazeApp extends JFrame {
private final MazeMenuBar mazeMenuBar;
private final WindowPanel windowPanel;
private Maze maze;
private MazeAppModel mazeAppModel = new MazeAppModel();
public MazeApp(Maze maze) {
public MazeApp() {
super("Maze Solving Application");
setJMenuBar(mazeMenuBar = new MazeMenuBar(this));
setContentPane(windowPanel = new WindowPanel(this, maze)) ;
setContentPane(windowPanel = new WindowPanel(this)) ;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
}
public MazeAppModel getMazeAppModel() {
return mazeAppModel;
}
}
-1
View File
@@ -10,7 +10,6 @@ public class QuitMenuItem extends JMenuItem {
super("Quit");
this.mazeApp = mazeApp;
}
}
+3 -4
View File
@@ -7,13 +7,12 @@ import java.awt.*;
public class WindowPanel extends JPanel
{
private final DrawingPanelGrid drawingPanelGrid;
private Maze maze;
public WindowPanel(MazeApp mazeApp, Maze maze)
{
public WindowPanel(MazeApp mazeApp) {
setLayout(new BorderLayout());
add(drawingPanelGrid = new DrawingPanelGrid(mazeApp, maze), BorderLayout.CENTER);
add(drawingPanelGrid = new DrawingPanelGrid(mazeApp), BorderLayout.CENTER);
}
}