/
MoveButtons.java
81 lines (63 loc) · 1.84 KB
/
MoveButtons.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class MoveButtons{
//RedSquare redSquare = new RedSquare();
private LinkedList<ButtonCreator> locationButtons;
public MoveButtons(){
locationButtons = new LinkedList<ButtonCreator>();
}
public void clearButtons(){
locationButtons.clear();
}
public LinkedList<JButton> getButtons(){
LinkedList<JButton> JMove = new LinkedList<JButton>();
for(int i = 0; i < locationButtons.size(); i++){
JMove.add(locationButtons.get(i).getJButton());
}
return JMove;
}
public void addButtons(LinkedList<Location> neighbors){
for(int i = 0; i < neighbors.size(); i++){
createRoleButton(neighbors.get(i));
}
}
private void createRoleButton(Location opt){
ButtonCreator neighbor = new ButtonCreator(opt.getLocationName());
if(opt.getSet().getShotCounter() != 0){
String plural = "";
if(opt.getSet().getShotCounter() != 1){
plural = "s";
}
neighbor.createOneLineButton(opt.getSet().getShotCounter() + " Shot" + plural + " Remaining", "UP");//shotCounterDisplay(opt.getSet().getShotCounter()));
}
neighbor.setVisibility(false);
neighbor.setCommand(Integer.toString(opt.getID()));
neighbor.setStatus(true);
/*if(w.getWorkType().equals("MAIN")){
//add celebrity icon next to button
}*/
//actor.changeSize(200,100);
locationButtons.add(neighbor);
}
public int getID(String name){
int curr = 0;
while(curr != locationButtons.size() && !name.equals(locationButtons.get(curr).getName())){
curr++;
}
if(curr == locationButtons.size()){
return -1;
}else{
return curr;
}
}
public void hide(int ID){
locationButtons.get(ID).setVisibility(false);
}
public void show(int ID){
locationButtons.get(ID).setVisibility(true);
}
public void actionPerformed(ActionEvent e) {
}
}