separate controlers

This commit is contained in:
philippe lhardy
2017-11-15 22:33:56 +01:00
parent 966ad6f269
commit 698394d9e1

View File

@@ -64,7 +64,8 @@ public class Display extends JFrame
Container con = this.getContentPane();
con.add(new JScrollPane(maze), BorderLayout.CENTER);
controler = new MazeControler();
con.add(controler, BorderLayout.NORTH);
con.add(controler.getMoveControl(), BorderLayout.NORTH);
con.add(controler.getGenerationControl(), BorderLayout.SOUTH);
addComponentListener(new ComponentAdapter() {
@Override
@@ -239,11 +240,13 @@ public class Display extends JFrame
*/
private static final long serialVersionUID = 1L;
private MazeSettings settings = null;
public MazeControler()
{
MazeSettings settings = new MazeSettings();
controlPanel = new JPanel();
settings = new MazeSettings();
JButton button = new JButton("Resolve");
button.addActionListener(new ActionListener()
{
@@ -349,6 +352,16 @@ public class Display extends JFrame
add(settings,BorderLayout.EAST);
}
private JPanel getMoveControl()
{
return this;
}
private JPanel getGenerationControl()
{
return settings;
}
}
private JButton addDirection(final JPanel panel, final String direction, String key, Action goAction)