This commit is contained in:
goblinrf 2023-11-29 15:32:24 +03:00
parent ceee7cf028
commit 807990537b
3 changed files with 5 additions and 11 deletions

View File

@ -36,7 +36,7 @@ public class FormAirFighter {
canv.repaint();
}
public void ChangeAirplane(DrawningAirplane newAirplane){
newAirplane.SetPosition(0,0);
newAirplane.SetPosition(0,70);
DrawningAirplane = newAirplane;
canv.DrawningAirplane = DrawningAirplane;

View File

@ -107,8 +107,8 @@ public class FormAirFighterCollection {
if(_trashCollection.GetSize() == 0)
return;
FormAirFighter form = new FormAirFighter();
form.ChangeAirplane(_trashCollection.GetTop());
_trashCollection.Pop();
form.ChangeAirplane(_trashCollection.Pop());
}
});
addButton.addActionListener(new ActionListener() {

View File

@ -20,13 +20,7 @@ public class AirplaneTrashCollection <T extends DrawningAirplane> {
return _queue.size();
}
public void Pop(){
if(_queue.size() ==0)
return;
_queue.remove();
}
public T GetTop(){
return _queue.peek();
public T Pop(){
return _queue.remove();
}
}