});
weakStrategyButton
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AbstractTower t;
t = (AbstractTower) context.selectTower();
System.out.println("test: " + t.isReady());
if (t.isReady()) {
if (weakStrategyButton.getModel().isSelected()) {
FindCreepStrategy fcs = new FindWeakestCreep(t);
fcs.setCreepLock(lockCreepButton.getModel()
.isSelected());
context.setStrategy(fcs);
} else {
weakStrategyButton.setSelected(true);
}} else
weakStrategyButton.setSelected(false);
}
});
hardStrategyButton
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AbstractTower t;
t = (AbstractTower) context.selectTower();
if (t.isReady()) {
if (hardStrategyButton.getModel().isSelected()) {
FindCreepStrategy fcs = new FindStrongestCreep(t);
fcs.setCreepLock(lockCreepButton.getModel()
.isSelected());
context.setStrategy(fcs);
} else {
hardStrategyButton.setSelected(true);
}} else
hardStrategyButton.setSelected(false);
}
});
closeStrategyButton
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AbstractTower t;
t = (AbstractTower) context.selectTower();
if (t.isReady()) {
if (closeStrategyButton.getModel().isSelected()) {
FindCreepStrategy fcs = new FindClosestCreep(t);
fcs.setCreepLock(lockCreepButton.getModel()
.isSelected());
context.setStrategy(fcs);
} else {
closeStrategyButton.setSelected(true);
}} else
closeStrategyButton.setSelected(false);
}
});
fastestStrategyButton
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AbstractTower t;
t = (AbstractTower) context.selectTower();
if (t.isReady()) {
if (fastestStrategyButton.getModel().isSelected()) {
FindCreepStrategy fcs = new FindFastestCreep(t);
fcs.setCreepLock(lockCreepButton.getModel()
.isSelected());
context.setStrategy(fcs);
} else {
fastestStrategyButton.setSelected(true);
}} else
fastestStrategyButton.setSelected(false);
}
});
lockCreepButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AbstractTower t;
t = (AbstractTower) context.getSelectedTower();
if (t.isReady()) {
FindCreepStrategy fcs = null;
if (fastestStrategyButton.getModel().isSelected())
fcs = new FindFastestCreep(t);
if (closeStrategyButton.getModel().isSelected())
fcs = new FindClosestCreep(t);