lab4 some minor fixes

This commit is contained in:
Zakharov_Rostislav 2023-11-24 10:14:49 +04:00
parent d210db6966
commit 22c6e38b92

View File

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