one step beyong in resolution, still not finding all alternate path

add showAll button
reset maze size display at maze size change
This commit is contained in:
philippe lhardy
2017-12-04 22:34:34 +01:00
parent b5d27ed694
commit a43e1e5a68
2 changed files with 63 additions and 33 deletions

View File

@@ -422,6 +422,15 @@ public class Display extends JFrame
// control display panel contains controls for display
// zoom , autozoom.
final JPanel controlDisplayPanel = new JPanel(new BorderLayout());
final JCheckBox showAll = new JCheckBox("show all");
showAll.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
maze.setShowAll( showAll.isSelected());
}
});
final JSlider slider = new JSlider(2, 40);
slider.addChangeListener(new ChangeListener()
{
@@ -471,6 +480,7 @@ public class Display extends JFrame
quitButton.addActionListener(quitAction);
resizecontrol = new JPanel(new FlowLayout());
resizecontrol.add(showAll);
resizecontrol.add(slider);
resizecontrol.add(autoSlide);
resizecontrol.add(savePngButton);
@@ -541,6 +551,12 @@ public class Display extends JFrame
offsetY = y;
}
public void resetMazeWidthHeight(int mapw, int maph)
{
mapWidth = mapw;
mapHeight = maph;
}
public void adaptTo(double W, double H)
{
double w = ( W - offsetX ) / mapWidth;
@@ -750,7 +766,8 @@ public class Display extends JFrame
public void setShowAll(boolean showall )
{
this.showAll = showAll;
this.showAll = showall;
System.out.println(showAll ? "show all" : "X");
}
void checkExit()
@@ -835,9 +852,6 @@ public class Display extends JFrame
gY = map.getHeight() - 1;
}
/**
warning works only if new map has same dimensions than previous
*/
// public void resetWallsProvider(WallsProvider map)
public void resetWallsProvider(LabyModel map)
{
@@ -847,6 +861,7 @@ public class Display extends JFrame
drawingPath=null;
sX=0;
sY=0;
cp.resetMazeWidthHeight(map.getWidth(),map.getHeight());
}
public void setWallSize(int size)
@@ -970,9 +985,9 @@ public class Display extends JFrame
}
}
if (showAll)
if (this.showAll)
{
System.out.println("*");
pX = aX;
pY = aY;