From e714e00fdb2586df1b7e8cc8e3f702551926d918 Mon Sep 17 00:00:00 2001 From: artur-kalimullin <144933634+artur-kalimullin@users.noreply.github.com> Date: Sat, 15 Jun 2024 20:40:11 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D1=82=D0=B8=20=D0=B3=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Drawnings/DrawningConstructor.java | 7 +++-- .../src/Forms/FormAirCraftCollection.java | 24 +++++++-------- .../src/Forms/FormConstructor.java | 30 +++++++++---------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/ProjectAirFighter/src/Drawnings/DrawningConstructor.java b/ProjectAirFighter/src/Drawnings/DrawningConstructor.java index 55af2ff..c6d4aed 100644 --- a/ProjectAirFighter/src/Drawnings/DrawningConstructor.java +++ b/ProjectAirFighter/src/Drawnings/DrawningConstructor.java @@ -31,18 +31,19 @@ public class DrawningConstructor extends JComponent { _drawEngine = new DrawningLongEngine(); break; } - int engineCount = rnd.nextInt(1,4); + int[] countengine = {2, 4, 6}; + int engineCount = countengine[rnd.nextInt(countengine.length)]; _drawEngine.setNumber(engineCount); int typeBoat = rnd.nextInt(0,2); switch (typeBoat) { case 0: - _entityAirCraft = new EntityAirCraft(rnd.nextInt(30,100), rnd.nextInt(100,500), + _entityAirCraft = new EntityAirCraft(rnd.nextInt(70 - 30) + 30, rnd.nextInt(500 - 100) + 100, new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256))); break; case 1: - _entityAirCraft = new EntityAirFighter(rnd.nextInt(30,100), rnd.nextInt(100,500), + _entityAirCraft = new EntityAirFighter(rnd.nextInt(70 - 30) + 30, rnd.nextInt(500 - 100) + 100, new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)), new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)), rnd.nextBoolean(), rnd.nextBoolean()); diff --git a/ProjectAirFighter/src/Forms/FormAirCraftCollection.java b/ProjectAirFighter/src/Forms/FormAirCraftCollection.java index 85530a0..500f349 100644 --- a/ProjectAirFighter/src/Forms/FormAirCraftCollection.java +++ b/ProjectAirFighter/src/Forms/FormAirCraftCollection.java @@ -25,8 +25,8 @@ public class FormAirCraftCollection extends JFrame { final private JPanel labelPanel = new JPanel(); final private JButton buttonAddAirCraft = new JButton("Добавить самолёт"); final private JButton buttonAddAirFighter = new JButton("Добавить истребитель"); - final private JPanel addBoatPanel = new JPanel(); - final private JPanel addCatamaranPanel = new JPanel(); + final private JPanel addAirCraftPanel = new JPanel(); + final private JPanel addAirFighterPanel = new JPanel(); final private JButton buttonRemove = new JButton("Удалить самолёт"); final private JPanel removePanel = new JPanel(); final private JButton goToCheckButton = new JButton("Отправить на тесты"); @@ -51,13 +51,13 @@ public class FormAirCraftCollection extends JFrame { comboBoxPanel.setSize(new Dimension(130, 30)); comboBoxPanel.add(comboBoxSelectorCompany, BorderLayout.CENTER); - addBoatPanel.setLayout(new BorderLayout()); - addBoatPanel.setSize(170, 40); - addBoatPanel.add(buttonAddAirCraft, BorderLayout.CENTER); + addAirCraftPanel.setLayout(new BorderLayout()); + addAirCraftPanel.setSize(170, 40); + addAirCraftPanel.add(buttonAddAirCraft, BorderLayout.CENTER); - addCatamaranPanel.setLayout(new BorderLayout()); - addCatamaranPanel.setSize(170, 40); - addCatamaranPanel.add(buttonAddAirFighter, BorderLayout.CENTER); + addAirFighterPanel.setLayout(new BorderLayout()); + addAirFighterPanel.setSize(170, 40); + addAirFighterPanel.add(buttonAddAirFighter, BorderLayout.CENTER); removePanel.setLayout(new BorderLayout()); removePanel.setSize(170, 40); @@ -92,8 +92,8 @@ public class FormAirCraftCollection extends JFrame { jFrameCollectionAirCraft.add(toolsPanel); jFrameCollectionAirCraft.add(labelPanel); jFrameCollectionAirCraft.add(comboBoxPanel); - jFrameCollectionAirCraft.add(addBoatPanel); - jFrameCollectionAirCraft.add(addCatamaranPanel); + jFrameCollectionAirCraft.add(addAirCraftPanel); + jFrameCollectionAirCraft.add(addAirFighterPanel); jFrameCollectionAirCraft.add(textBoxPanel); jFrameCollectionAirCraft.add(removePanel); jFrameCollectionAirCraft.add(goToCheckPanel); @@ -106,8 +106,8 @@ public class FormAirCraftCollection extends JFrame { labelPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 210, 0); toolsPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 233, 0); comboBoxPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 30); - addBoatPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 70); - addCatamaranPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 120); + addAirCraftPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 70); + addAirFighterPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 120); textBoxPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 220); removePanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 260); goToCheckPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 300); diff --git a/ProjectAirFighter/src/Forms/FormConstructor.java b/ProjectAirFighter/src/Forms/FormConstructor.java index 975a148..4977bfe 100644 --- a/ProjectAirFighter/src/Forms/FormConstructor.java +++ b/ProjectAirFighter/src/Forms/FormConstructor.java @@ -26,10 +26,10 @@ public class FormConstructor extends JFrame { JLabel secondEntityLabel = new JLabel(); JLabel thirdEntityLabel = new JLabel(); - JPanel paddlesInfoPanel = new JPanel(); - JLabel firstPaddlesLabel = new JLabel(); - JLabel secondPaddlesLabel = new JLabel(); - JLabel thirdPaddlesLabel = new JLabel(); + JPanel engineInfoPanel = new JPanel(); + JLabel firstEngineLabel = new JLabel(); + JLabel secondEngineLabel = new JLabel(); + JLabel thirdEngineLabel = new JLabel(); public void OpenFrame() { @@ -51,23 +51,23 @@ public class FormConstructor extends JFrame { entitiesInfoPanel.add(secondEntityLabel); entitiesInfoPanel.add(thirdEntityLabel); - firstPaddlesLabel.setText(constructor.getEngineString(0)); - secondPaddlesLabel.setText(constructor.getEngineString(1)); - thirdPaddlesLabel.setText(constructor.getEngineString(2)); + firstEngineLabel.setText(constructor.getEngineString(0)); + secondEngineLabel.setText(constructor.getEngineString(1)); + thirdEngineLabel.setText(constructor.getEngineString(2)); - paddlesInfoPanel.setLayout(new BoxLayout(paddlesInfoPanel, BoxLayout.Y_AXIS)); - paddlesInfoPanel.setBorder(BorderFactory.createTitledBorder("Engine")); - paddlesInfoPanel.setSize(500, 130); - paddlesInfoPanel.setLocation(150, 150); - paddlesInfoPanel.add(firstPaddlesLabel); - paddlesInfoPanel.add(secondPaddlesLabel); - paddlesInfoPanel.add(thirdPaddlesLabel); + engineInfoPanel.setLayout(new BoxLayout(engineInfoPanel, BoxLayout.Y_AXIS)); + engineInfoPanel.setBorder(BorderFactory.createTitledBorder("Engine")); + engineInfoPanel.setSize(500, 130); + engineInfoPanel.setLocation(150, 150); + engineInfoPanel.add(firstEngineLabel); + engineInfoPanel.add(secondEngineLabel); + engineInfoPanel.add(thirdEngineLabel); addButton.setBounds(0, jFrameConstructor.getHeight() - 105, 150, 50); reCreateButton.setBounds(0, jFrameConstructor.getHeight() - 135, 150, 30); - jFrameConstructor.add(paddlesInfoPanel); + jFrameConstructor.add(engineInfoPanel); jFrameConstructor.add(entitiesInfoPanel); jFrameConstructor.add(addButton); jFrameConstructor.add(reCreateButton);