From 17d9a3f417ddd4609d3a2e8c59d59333031a8d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=91=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=D0=BD=D0=B8=D0=BD?= Date: Sun, 12 Nov 2023 15:31:20 +0400 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BE=D1=82=D0=BE=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tank/src/FormTank.java | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Tank/src/FormTank.java b/Tank/src/FormTank.java index ed6e99a..cf2130c 100644 --- a/Tank/src/FormTank.java +++ b/Tank/src/FormTank.java @@ -49,23 +49,23 @@ public class FormTank { }); JButton up = new JButton(); up.setName("up"); - ImageIcon iconUp = new ImageIcon("Tank//Resources//KeyUp.png"); + ImageIcon iconUp = new ImageIcon("Resources//KeyUp.png"); up.setIcon(iconUp); JButton down = new JButton(); down.setName("down"); - ImageIcon iconDown = new ImageIcon("Tank//Resources//KeyDown.png"); + ImageIcon iconDown = new ImageIcon("Resources//KeyDown.png"); down.setIcon(iconDown); JButton left = new JButton(); left.setName("left"); - ImageIcon iconLeft = new ImageIcon("Tank//Resources//KeyLeft.png"); + ImageIcon iconLeft = new ImageIcon("Resources//KeyLeft.png"); left.setIcon(iconLeft); JButton right = new JButton(); right.setName("right"); - ImageIcon iconRight = new ImageIcon("Tank//Resources//KeyRight.png"); + ImageIcon iconRight = new ImageIcon("Resources//KeyRight.png"); right.setIcon(iconRight); buttonStrategysStep.addActionListener( @@ -86,13 +86,11 @@ public class FormTank { abstractStrategy = null; break; } - ; + if (abstractStrategy == null) { return; } - abstractStrategy.SetData(new - DrawingObjectTank(_drawingTank), pictureBoxWidth, - pictureBoxHeight); + abstractStrategy.SetData(new DrawingObjectTank(_drawingTank), pictureBoxWidth, pictureBoxHeight); comboBoxStrategy.setEnabled(false); } if (abstractStrategy == null) { @@ -110,7 +108,6 @@ public class FormTank { buttonCreateTank.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { - System.out.println(e.getActionCommand()); Random random = new Random(); Color color = new Color(random.nextInt(0, 256), random.nextInt(0, 256), random.nextInt(0, 256)); // Вызываем диалоговое окно выбора цвета @@ -118,18 +115,18 @@ public class FormTank { if (selectedColor != null) { color = selectedColor; } - Color color2 = new Color(random.nextInt(0, 256), random.nextInt(0, 256), random.nextInt(0, 256)); + Color coloradditional = new Color(random.nextInt(0, 256), random.nextInt(0, 256), random.nextInt(0, 256)); // Вызываем диалоговое окно выбора цвета selectedColor = JColorChooser.showDialog(Frame, "Выберите цвет", Color.WHITE); if (selectedColor != null) { - color2 = selectedColor; + coloradditional = selectedColor; } _drawingTank = new DrawingTank( random.nextInt(100, 300), random.nextInt(1000, 3000), color, random.nextInt(2, 5), - color2, + coloradditional, true, true, true, @@ -145,7 +142,6 @@ public class FormTank { buttonCreate.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { - System.out.println(e.getActionCommand()); Random random = new Random(); Color color = new Color(random.nextInt(0, 256), random.nextInt(0, 256), random.nextInt(0, 256)); // Вызываем диалоговое окно выбора цвета @@ -170,7 +166,6 @@ public class FormTank { ActionListener actioListener = new ActionListener() { public void actionPerformed(ActionEvent e) { - System.out.println(((JButton) (e.getSource())).getName()); if (_drawingTank == null) { return; }