Refactorize code

This commit is contained in:
antograb committed 2018-01-10 18:32:38 +01:00
1 parent 3520bfc4ce
commit eaba5b6106
12 files changed
+144 -50

No files matched your search

+3 -1
View File
@@ -5,6 +5,7 @@ import javax.swing.JMenuItem;
import maze.Box;
public class BoxTypeEditionMenu extends JPopupMenu {
JMenuItem setWBox;
JMenuItem setEBox;
JMenuItem setDBox;
@@ -15,11 +16,12 @@ public class BoxTypeEditionMenu extends JPopupMenu {
JMenuItem delLine;
public BoxTypeEditionMenu(MazeApp mazeApp, int boxLine, int boxRow) {
add(setEBox = new SetEBoxMenuItem(mazeApp, boxLine, boxRow));
add(setWBox = new SetWBoxMenuItem(mazeApp, boxLine, boxRow));
add(setDBox = new SetDBoxMenuItem(mazeApp, boxLine, boxRow));
add(setABox = new SetABoxMenuItem(mazeApp, boxLine, boxRow));
Box box = (Box) mazeApp.getMazeAppModel().getMaze().getMaze()[boxLine][boxRow];
Box box = (Box) mazeApp.getModelBox(boxLine, boxRow);
setEBox.setEnabled((box.isWalkable() && (box.isDeparture() ||
box.isArrival())) || ! box.isWalkable());
setWBox.setEnabled(box.isWalkable());