add reset button + title
default to 20x20 maze
This commit is contained in:
@@ -63,7 +63,7 @@ public class Display extends JFrame
|
||||
|
||||
Display(LabyModel model,int W, int H, MazeParams params)
|
||||
{
|
||||
super("Maze display");
|
||||
super(labels.getString("title"));
|
||||
if (params != null)
|
||||
{
|
||||
// fixedParams = new MazeParamsFixed(params.getSaveDir(),params.getWidth(),params.getHeight(),params.getMaxDepth());
|
||||
@@ -114,6 +114,7 @@ public class Display extends JFrame
|
||||
maze.resetWallsProvider(model);
|
||||
model.setMazeListener(maze);
|
||||
|
||||
|
||||
// we are in GUI event thread, need to release it and do it outside.
|
||||
new Thread() {
|
||||
public void run() {
|
||||
@@ -122,6 +123,27 @@ public class Display extends JFrame
|
||||
model.addEntryOrExit(params.getWidth(), params.getHeight() - 1);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
void resetModel()
|
||||
{
|
||||
// recreate labyrinth
|
||||
if (params != null)
|
||||
{
|
||||
params = controler.getSettings().getParams();
|
||||
model = new LabyModel(params, new java.util.Random());
|
||||
maze.resetWallsProvider(model);
|
||||
model.setMazeListener(maze);
|
||||
|
||||
|
||||
// we are in GUI event thread, need to release it and do it outside.
|
||||
new Thread() {
|
||||
public void run() {
|
||||
maze.changed(null,null,model);
|
||||
}
|
||||
}.start();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -208,8 +230,19 @@ public class Display extends JFrame
|
||||
{
|
||||
recreateModel();
|
||||
}
|
||||
});
|
||||
});
|
||||
add(buttonCreate);
|
||||
|
||||
JButton buttonReset = new JButton("reset");//labels.getString("reset"));
|
||||
buttonReset.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
resetModel();
|
||||
}
|
||||
});
|
||||
add(buttonReset);
|
||||
|
||||
}
|
||||
if ( params != null )
|
||||
{
|
||||
@@ -1044,7 +1077,7 @@ public class Display extends JFrame
|
||||
}
|
||||
else
|
||||
{
|
||||
MazeParamsFixed params = new MazeParamsFixed(new File("lab"),60,60,15);
|
||||
MazeParamsFixed params = new MazeParamsFixed(new File("lab"),20,20,12);
|
||||
model = new LabyModel(params, new java.util.Random());
|
||||
|
||||
setupDisplay(model,W,H,params);
|
||||
|
||||
@@ -8,4 +8,5 @@ west = West
|
||||
resolve = Resolve
|
||||
create = Create
|
||||
save = Save
|
||||
quit = Quit
|
||||
quit = Quit
|
||||
title = A Maz ing
|
||||
@@ -8,4 +8,5 @@ west = Ouest
|
||||
resolve = Résoudre
|
||||
create = Créer
|
||||
save = Sauver
|
||||
quit = Quitter
|
||||
quit = Quitter
|
||||
title = La Bireinte
|
||||
Reference in New Issue
Block a user