lab4 some minor fixes

This commit is contained in:
Zakharov_Rostislav 2023-11-24 10:19:26 +04:00
parent 22c6e38b92
commit 234aa190c8

View File

@ -188,8 +188,7 @@ public class FrameShipsCollection extends JFrame {
pictureBoxCollection.repaint();
}
private void buttonTrashClick(){
DrawingShip ship = trashCollection.pop();
if(ship == null)
if (trashCollection.size() == 0)
return;
FrameBattleship form;
try {
@ -197,6 +196,6 @@ public class FrameShipsCollection extends JFrame {
} catch (IOException e) {
throw new RuntimeException(e);
}
form.setShip(ship);
form.setShip(trashCollection.pop());
}
}