Skip to content

Commit

Permalink
logger files will kill me
Browse files Browse the repository at this point in the history
  • Loading branch information
siqq committed Sep 6, 2014
1 parent de4b380 commit 9d89b22
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 43 deletions.
78 changes: 41 additions & 37 deletions Java-Missle/src/view/ProgressPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,52 +55,19 @@ public void addMissileToProgressBar(String missileId, String destination, int da
button.setOpaque(false);
button.setContentAreaFilled(false);
button.setBorderPainted(false);





label.setHorizontalTextPosition(JLabel.CENTER);
label.setVerticalTextPosition(JLabel.CENTER);
label.setBorder(new EmptyBorder(15, 15, 15, 15));
label.setFont(myFont);
label.setText(missileId +" "+ destination + " " + damage);
progressBar.add(label, BorderLayout.CENTER);
progressBar.add(button, BorderLayout.EAST);

add(progressBar);
// setVisible(true);
map.put(missileId, progressBar);
validate();
}
public void updateMissileTime(int time , String missileId, String type ) {
Iterator<String> keySetIterator = map.keySet().iterator();
Iterator<String> destuctorsSetIterator = destructors.keySet().iterator();
if(type == "missile"){
while(keySetIterator.hasNext()){ //for missiles
String key = keySetIterator.next();
if(key.equalsIgnoreCase(missileId)){
progressBar = map.get(key);
progressBar.setForeground(Color.RED);
progressBar.setValue(time);
System.out.println(time);
}

}
}
else if (type == "destructor"){
while(destuctorsSetIterator.hasNext()){ //for desturctors
String key = destuctorsSetIterator.next();
if(key.equalsIgnoreCase(missileId)){
progressBar = destructors.get(key);
progressBar.setForeground(Color.BLUE);
progressBar.setValue(time);
System.out.println(time);
}

}
}


}

public void destroyProgress(String missileId, String type) {
Iterator<String> keySetIterator = map.keySet().iterator();
Expand Down Expand Up @@ -133,12 +100,49 @@ public void addDestryoerToProgressBar(String destructor_id, String target_id,
label.setVerticalTextPosition(JLabel.CENTER);
label.setBorder(new EmptyBorder(15, 15, 15, 15));
label.setFont(myFont);
label.setText(destructor_id +" Targeting "+ target_id + " ");
progressBar.add(label, BorderLayout.CENTER);
add(progressBar);
destructors.put(target_id, progressBar);
validate();
}
}
public void updateMissileTime(int time, String missileId, String type,
String destination, int damage, int flyTime) {
Iterator<String> keySetIterator = map.keySet().iterator();
Iterator<String> destuctorsSetIterator = destructors.keySet().iterator();
if(type == "missile"){
while(keySetIterator.hasNext()){ //for missiles
String key = keySetIterator.next();
if(key.equalsIgnoreCase(missileId)){
progressBar = map.get(key);
progressBar.setForeground(Color.RED);
progressBar.setValue(time);
System.out.println(time);
JLabel temp = (JLabel)progressBar.getComponent(0);
temp.setText("Missile id#" + missileId +" Will Hit "+ destination + " for " + damage + " damage in " + (flyTime - time) +"s");

}

}
}
else if (type == "destructor"){
while(destuctorsSetIterator.hasNext()){ //for desturctors
String key = destuctorsSetIterator.next();
if(key.equalsIgnoreCase(missileId)){
progressBar = destructors.get(key);
progressBar.setForeground(Color.BLUE);
progressBar.setValue(time);
System.out.println(time);
JLabel temp = (JLabel)progressBar.getComponent(0);
temp.setText(destination +" Will Hit Launcher #"+ missileId + " in " + (flyTime - time) +"s");

}

}
}



}



Expand Down
12 changes: 6 additions & 6 deletions Java-Missle/src/view/WarGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ public void addDestroyerProgress(String destructor_id,
}

@Override
public void updateMissileProgress(int time, String missileId,
String type) {
progressPanel.updateMissileTime(time, missileId, type);
public void removeLauncherFromView(String launcherId) {
launchersPanel.removeLauncher(launcherId);

}

@Override
public void removeLauncherFromView(String launcherId) {
launchersPanel.removeLauncher(launcherId);

public void updateMissileProgress(int time, String missileId, String type,
String destination, int damage, int flyTime) {
progressPanel.updateMissileTime(time, missileId, type,destination,damage,flyTime);

}

}

0 comments on commit 9d89b22

Please sign in to comment.