|
@@ -24,17 +24,17 @@ public class Controls extends JPanel implements Observer
|
|
|
{
|
|
|
grid.setSelected(true);
|
|
|
list.setSelected(false);
|
|
|
- model.switchLayout();
|
|
|
+ model.switchLayout(true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
list.setSelected(true);
|
|
|
grid.setSelected(false);
|
|
|
- model.switchLayout();
|
|
|
+ model.switchLayout(false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ private customListener customlistener;
|
|
|
private ButtonGroup layouts;
|
|
|
private Image starImg;
|
|
|
private Image gridImg;
|
|
@@ -50,9 +50,8 @@ public class Controls extends JPanel implements Observer
|
|
|
// Bob the Builder this shit
|
|
|
public Controls(Model model)
|
|
|
{
|
|
|
- // Hook up this observer so that it will be notified when the model
|
|
|
- // changes.
|
|
|
this.model = model;
|
|
|
+ this.customlistener = new customListener();
|
|
|
this.setBackground(Color.cyan);
|
|
|
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
|
|
|
this.setPreferredSize(new Dimension(1280,75));
|
|
@@ -89,10 +88,10 @@ public class Controls extends JPanel implements Observer
|
|
|
this.folderIcon = new ImageIcon(folderImg);
|
|
|
|
|
|
this.grid = new JRadioButton(gridIcon, true);
|
|
|
- grid.addActionListener(customListener);
|
|
|
+ grid.addActionListener(customlistener);
|
|
|
|
|
|
this.list = new JRadioButton(listIcon, false);
|
|
|
- list.addActionListener(customListener);
|
|
|
+ list.addActionListener(customlistener);
|
|
|
|
|
|
this.layouts = new ButtonGroup();
|
|
|
layouts.add(grid);
|