From 12e650cdb785d1a1285965b15d1cd715a471ad62 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 16:09:58 +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 | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Tank/src/FormTank.java b/Tank/src/FormTank.java index 47d70b9..8697c92 100644 --- a/Tank/src/FormTank.java +++ b/Tank/src/FormTank.java @@ -10,19 +10,19 @@ public class FormTank { } public void paintComponent(Graphics g) { - if (_drawingTank == null) { + if (_drawingVehicle == null) { return; } super.paintComponents(g); Graphics2D g2d = (Graphics2D) g; - _drawingTank.DrawTransport(g2d); + _drawingVehicle.DrawTransport(g2d); super.repaint(); } } public DrawingArmoVehicle SelectedVehicle; public boolean DialogResult = false; - public DrawingArmoVehicle _drawingTank; + public DrawingArmoVehicle _drawingVehicle; private AbstractStrategy abstractStrategy; Canvas canv; static int pictureBoxWidth = 980; @@ -42,7 +42,7 @@ public class FormTank { JButton buttonStrategysStep = new JButton("Шаг"); buttonSelectTank = new JButton("Добавить"); - JComboBox comboBoxStrategy = new JComboBox( + JComboBox ComboBoxStrategy = new JComboBox( new String[]{ "к центру", "к краю", @@ -71,11 +71,11 @@ public class FormTank { buttonStrategysStep.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { - if (_drawingTank == null) { + if (_drawingVehicle == null) { return; } - if (comboBoxStrategy.isEnabled()) { - switch (comboBoxStrategy.getSelectedIndex()) { + if (ComboBoxStrategy.isEnabled()) { + switch (ComboBoxStrategy.getSelectedIndex()) { case 0: abstractStrategy = new MoveToCenter(); break; @@ -90,8 +90,8 @@ public class FormTank { if (abstractStrategy == null) { return; } - abstractStrategy.SetData(new DrawingObjectTank(_drawingTank), pictureBoxWidth, pictureBoxHeight); - comboBoxStrategy.setEnabled(false); + abstractStrategy.SetData(new DrawingObjectTank(_drawingVehicle), pictureBoxWidth, pictureBoxHeight); + ComboBoxStrategy.setEnabled(false); } if (abstractStrategy == null) { return; @@ -99,7 +99,7 @@ public class FormTank { abstractStrategy.MakeStep(); Draw(); if (abstractStrategy.GetStatus() == Status.Finish) { - comboBoxStrategy.setEnabled(true); + ComboBoxStrategy.setEnabled(true); abstractStrategy = null; } } @@ -121,7 +121,7 @@ public class FormTank { if (selectedColor != null) { coloradditional = selectedColor; } - _drawingTank = new DrawingTank( + _drawingVehicle = new DrawingTank( random.nextInt(100, 300), random.nextInt(1000, 3000), color, @@ -134,7 +134,7 @@ public class FormTank { pictureBoxHeight, true ); - _drawingTank.SetPosition(random.nextInt(10, 100), random.nextInt(10, 100)); + _drawingVehicle.SetPosition(random.nextInt(10, 100), random.nextInt(10, 100)); Draw(); } } @@ -149,7 +149,7 @@ public class FormTank { if (selectedColor != null) { color = selectedColor; } - _drawingTank = new DrawingArmoVehicle( + _drawingVehicle = new DrawingArmoVehicle( random.nextInt(100, 300), random.nextInt(1000, 3000), color, @@ -158,7 +158,7 @@ public class FormTank { pictureBoxHeight ); - _drawingTank.SetPosition(random.nextInt(10, 100), random.nextInt(10, 100)); + _drawingVehicle.SetPosition(random.nextInt(10, 100), random.nextInt(10, 100)); Draw(); } } @@ -166,21 +166,21 @@ public class FormTank { ActionListener actioListener = new ActionListener() { public void actionPerformed(ActionEvent e) { - if (_drawingTank == null) { + if (_drawingVehicle == null) { return; } switch (((JButton) (e.getSource())).getName()) { case "up": - _drawingTank.MoveTransport(Direction.Up); + _drawingVehicle.MoveTransport(Direction.Up); break; case "down": - _drawingTank.MoveTransport(Direction.Down); + _drawingVehicle.MoveTransport(Direction.Down); break; case "left": - _drawingTank.MoveTransport(Direction.Left); + _drawingVehicle.MoveTransport(Direction.Left); break; case "right": - _drawingTank.MoveTransport(Direction.Right); + _drawingVehicle.MoveTransport(Direction.Right); break; } Draw(); @@ -201,7 +201,7 @@ public class FormTank { down.setBounds(900, 520, 40, 40); left.setBounds(860, 520, 40, 40); right.setBounds(940, 520, 40, 40); - comboBoxStrategy.setBounds(pictureBoxWidth - 150, 20, 150, 20); + ComboBoxStrategy.setBounds(pictureBoxWidth - 150, 20, 150, 20); buttonStrategysStep.setBounds(pictureBoxWidth - 150, 45, 150, 20); buttonSelectTank.setBounds(pictureBoxWidth / 2, 530, 150, 30); Frame.add(buttonSelectTank); @@ -212,7 +212,7 @@ public class FormTank { Frame.add(down); Frame.add(left); Frame.add(right); - Frame.add(comboBoxStrategy); + Frame.add(ComboBoxStrategy); Frame.add(buttonStrategysStep); Frame.setVisible(true); }