Fix add column/line and spinners, cleanup Maintest
* Remove legacy test code in MainTest maze: * Add methods to add/del lines and columns * Add various calls to matrixDeepCopy, allowing to overwrite only a part of a matrix model: * Better delegation to Maze : let Maze handle column/line adds/deletions ui: * Add buttons to context menu to add/remove lines and columns * Add buttons to Maze Menu to delete lines and columns * Fix the spinners, it used to call a new instance of itself, which made impossible to simple get the values from the spinners
This commit is contained in:
1 parent
286023c5d8
commit
024a4f70c3
12 files changed
+403
-135
No files matched your search
@@ -3,25 +3,37 @@ package ui;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
public class AddRowMenuItem extends JMenuItem
|
||||
implements ActionListener {
|
||||
|
||||
private final MazeApp mazeApp;
|
||||
private final int rowNum;
|
||||
|
||||
public AddRowMenuItem(MazeApp mazeApp) {
|
||||
|
||||
super("Add row");
|
||||
this.mazeApp = mazeApp;
|
||||
rowNum = -1;
|
||||
addActionListener(this);
|
||||
}
|
||||
|
||||
public AddRowMenuItem(MazeApp mazeApp, int rowNum) {
|
||||
|
||||
super("Add row");
|
||||
this.mazeApp = mazeApp;
|
||||
this.rowNum = rowNum;
|
||||
addActionListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
|
||||
this.mazeApp.getMazeAppModel().addEmptyColumn();
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (rowNum == -1) {
|
||||
mazeApp.addEmptyColumn();
|
||||
}
|
||||
else {
|
||||
mazeApp.addEmptyColumn(rowNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user