From 27859f9317efd1e0bab00b1e637a3b194c4c5ec5 Mon Sep 17 00:00:00 2001 From: VirBiuM Date: Mon, 26 Feb 2024 12:52:32 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectAirFighter/.idea/uiDesigner.xml | 124 ++++++++++++++++ ProjectAirFighter/ProjectAirFighter.iml | 1 + ProjectAirFighter/Resources/arrowDown.jpg | Bin 0 -> 943 bytes ProjectAirFighter/Resources/arrowLeft.jpg | Bin 0 -> 932 bytes ProjectAirFighter/Resources/arrowRight.jpg | Bin 0 -> 935 bytes ProjectAirFighter/Resources/arrowUp.jpg | Bin 0 -> 923 bytes ProjectAirFighter/src/CountEngines.java | 13 ++ ProjectAirFighter/src/DirectionType.java | 6 + ProjectAirFighter/src/DrawningAirFighter.java | 137 ++++++++++++++++++ ProjectAirFighter/src/DrawningEngines.java | 27 ++++ ProjectAirFighter/src/EntityAirFighter.java | 39 +++++ ProjectAirFighter/src/FormAirFighter.form | 97 +++++++++++++ ProjectAirFighter/src/FormAirFighter.java | 105 ++++++++++++++ ProjectAirFighter/src/Main.java | 14 ++ 14 files changed, 563 insertions(+) create mode 100644 ProjectAirFighter/.idea/uiDesigner.xml create mode 100644 ProjectAirFighter/Resources/arrowDown.jpg create mode 100644 ProjectAirFighter/Resources/arrowLeft.jpg create mode 100644 ProjectAirFighter/Resources/arrowRight.jpg create mode 100644 ProjectAirFighter/Resources/arrowUp.jpg create mode 100644 ProjectAirFighter/src/CountEngines.java create mode 100644 ProjectAirFighter/src/DirectionType.java create mode 100644 ProjectAirFighter/src/DrawningAirFighter.java create mode 100644 ProjectAirFighter/src/DrawningEngines.java create mode 100644 ProjectAirFighter/src/EntityAirFighter.java create mode 100644 ProjectAirFighter/src/FormAirFighter.form create mode 100644 ProjectAirFighter/src/FormAirFighter.java create mode 100644 ProjectAirFighter/src/Main.java diff --git a/ProjectAirFighter/.idea/uiDesigner.xml b/ProjectAirFighter/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/ProjectAirFighter/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProjectAirFighter/ProjectAirFighter.iml b/ProjectAirFighter/ProjectAirFighter.iml index c90834f..d5b343a 100644 --- a/ProjectAirFighter/ProjectAirFighter.iml +++ b/ProjectAirFighter/ProjectAirFighter.iml @@ -3,6 +3,7 @@ + diff --git a/ProjectAirFighter/Resources/arrowDown.jpg b/ProjectAirFighter/Resources/arrowDown.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0c3f9999e40002d1a10994d9adf83c4c750a720a GIT binary patch literal 943 zcmex=^lOiET&UP@Y7ModgWM?qOlT~kX_QeM|USHnP6LsJ7}2qQZ?I~NC+Fc+7w zhLo6;2Fc+60R}-11~~>fW=16jCP7AKLB{__7~~lk7+Ha?1vwZB7@3%X?q%oT?FU=d^$QZ#gA6AnydS1J@SYMi)`L)mHLLD8U#A5@H! zikdjN#Ka{erBv0_H8izMOwG(KEUlbfT;1F~JiUTLLc_u%BBPR1Qq$5iGP89XZ3R<7E#dCS&q+js2Tb?ESsqsNY)IC<*Q zmHZUbH?xYs0&XCY{Wz ziJ#6FUJbsZ&r|^lOiET&UP@Y7ModgWM?qOlT~kX_QeM|USHnP6LsJ7}2qQZ?I~NC+Fc+7w zhLo6;2Fc+60R}-11~~>fW=16jCP7AKLB{__7~~lk7+Ha?1vwZB7@3%X?q%oT?FU=d^$QZ#gA6AnydS1J@SYMi)`L)mHLLD8U#A5@H! zikdjN#Ka{erBv0_H8izMOwG(KEUlbfT;1F~JiUTLLc_u%BBPR1Qq$5iGP89XZ3R<7E#dCS&q+js2Tb?ESsqsNY)IC<*Q zYA zzKFltC;l1NUD%c1lD_NW9z(8IRc~C5>r7%&*p_%j?%m-Fh3{|ev;P?1xplr+)}^dC z#r?B>ef)7(@ge*7P5A#@ zpB}mP7H4@LkdQwb^q=9d-;e(czjvAcV>18GAnqXV|0n2&_rvua)6U$Qy8mWrXpHNM z+YPGm4tM9)_CIi~N&M*jP`|TI_O5YO*?)$tOEWi$EzaZY+{;|<_RYT0^p|pA>}|)& zY~8JQ4E^)9rcBZdFxoY5LGwWo#!t`Y{??4V`|{g$^`q0d(mGRae-kL2z-RY2@;^hH q*QWmr3wJ&K&%hx5pP?`O@OjG}l4?|4jgIjA8}= literal 0 HcmV?d00001 diff --git a/ProjectAirFighter/Resources/arrowRight.jpg b/ProjectAirFighter/Resources/arrowRight.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0504710e0d17c9f82532d2aebcb538e233e29d8b GIT binary patch literal 935 zcmex=^lOiET&UP@Y7ModgWM?qOlT~kX_QeM|USHnP6LsJ7}2qQZ?I~NC+Fc+7w zhLo6;2Fc+60R}-11~~>fW=16jCP7AKLB{__7~~lk7+Ha?1vwZB7@3%X?q%oT?FU=d^$QZ#gA6AnydS1J@SYMi)`L)mHLLD8U#A5@H! zikdjN#Ka{erBv0_H8izMOwG(KEUlbfT;1F~JiUTLLc_u%BBPR1Qq$5iGP89XZ3R<7E#dCS&q+js2Tb?ESsqsNY)IC<*Q z%UR2oSC-0LblGrb<<{*R;vY($ zH~pq-l#w($eXf+}#^!ZT*|Ygts()W#KX#vEf7;*R_)n$w(vn-|8a$kKh9~BX?dN}M uYU}b7ukG9Z;e7j+`P?rJGiR~3h?xa`=~F%Czglih?K$79iw^StZvp_o{A$zy literal 0 HcmV?d00001 diff --git a/ProjectAirFighter/Resources/arrowUp.jpg b/ProjectAirFighter/Resources/arrowUp.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dc072fcae7ed102240a86cc17ee25a43f72806c2 GIT binary patch literal 923 zcmex=^lOiET&UP@Y7ModgWM?qOlT~kX_QeM|USHnP6LsJ7}2qQZ?I~NC+Fc+7w zhLo6;2Fc+60R}-11~~>fW=16jCP7AKLB{__7~~lk7+Ha?1vwZB7@3%X?q%oT?FU=d^$QZ#gA6AnydS1J@SYMi)`L)mHLLD8U#A5@H! zikdjN#Ka{erBv0_H8izMOwG(KEUlbfT;1F~JiUTLLc_u%BBPR1Qq$5iGP89XZ3R<7E#dCS&q+js2Tb?ESsqsNY)IC<*Q z*w z*WQ=rh9#SReX`bMUG?M}Rg4$-4lp{%FTBsOr!@N`_d&C&qx+8RVm`U2(f`-X2I=+- zAKW*J-U@&I{mu7}vj60M+%nrUasP&|OdI0$QzU<;9$z)7p6TAz?|cs)0 zO>>&~op>4COSALK8uJ!(m9i^%G&b1x)=2*jb`;%ytT#@(VsV!t?>-?@F7|if8`kgB zez5=6?tk88oBuP!yqA(r#)>Xc ikpvA1hN|#$^Ec}M>G<`Z;ctukzpkiXMh*7=Zvp_hGGgxl literal 0 HcmV?d00001 diff --git a/ProjectAirFighter/src/CountEngines.java b/ProjectAirFighter/src/CountEngines.java new file mode 100644 index 0000000..495ac36 --- /dev/null +++ b/ProjectAirFighter/src/CountEngines.java @@ -0,0 +1,13 @@ +public enum CountEngines { + Zero(0), + Two(2), + Four(4), + Six(6); + private int Count; + public int getCount() { + return Count; + } + CountEngines(int num){ + this.Count = num; + } +} \ No newline at end of file diff --git a/ProjectAirFighter/src/DirectionType.java b/ProjectAirFighter/src/DirectionType.java new file mode 100644 index 0000000..0d43823 --- /dev/null +++ b/ProjectAirFighter/src/DirectionType.java @@ -0,0 +1,6 @@ +public enum DirectionType { + Up, + Down, + Left, + Right, +} \ No newline at end of file diff --git a/ProjectAirFighter/src/DrawningAirFighter.java b/ProjectAirFighter/src/DrawningAirFighter.java new file mode 100644 index 0000000..7eda438 --- /dev/null +++ b/ProjectAirFighter/src/DrawningAirFighter.java @@ -0,0 +1,137 @@ +import java.awt.*; +import java.util.Random; + +public class DrawningAirFighter { + private EntityAirFighter EntityAirFighter; + public EntityAirFighter getEntityAirFighter() { + return EntityAirFighter; + } + private Integer _pictureWidth; + private Integer _pictureHeight; + private Integer _startPosX; + private Integer _startPosY; + private int _drawningPlaneWidth = 150; + private int _drawningPlaneHeight = 150; + private DrawningEngines DrawningEngines; + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean extraWings, boolean rockets) { + EntityAirFighter = new EntityAirFighter(); + EntityAirFighter.Init(speed, weight, bodyColor, additionalColor, extraWings, rockets); + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + DrawningEngines = new DrawningEngines(EntityAirFighter); + Random random = new Random(); + int Count = 2 * random.nextInt(4); + DrawningEngines.SetCountEngines(Count); + } + public boolean SetPictureSize(int width, int height) { + if (_drawningPlaneWidth > width || _drawningPlaneHeight > height) return false; + if (_startPosX != null && _startPosY != null) { + if (_startPosX < 0) { _startPosX = 0; } + if (_startPosX + _drawningPlaneWidth > width) { _startPosX = width - _drawningPlaneWidth; } + if (_startPosY < 0) { _startPosY = 0; } + if (_startPosY + _drawningPlaneHeight > height) { _startPosY = height - _drawningPlaneHeight; } + } + _pictureWidth = width; + _pictureHeight = height; + return true; + } + public void SetPosition(int x, int y) { + if (_pictureHeight == null || _pictureWidth == null) { + return; + } + if (x + _drawningPlaneWidth > _pictureWidth || x < 0) { + Random random = new Random(); + _startPosX = random.nextInt(_pictureWidth - _drawningPlaneWidth); + } + else { + _startPosX = x; + } + + if (y + _drawningPlaneHeight > _pictureHeight || y < 0) { + Random random = new Random(); + _startPosY = random.nextInt(_pictureHeight - _drawningPlaneHeight); + } + else { + _startPosY = y; + } + } + public boolean MoveTransport(DirectionType direction) { + if (EntityAirFighter == null || _startPosX == null || _startPosY == null) { + return false; + } + switch (direction) { + case Left: + if (_startPosX - EntityAirFighter.Step() > 0) { + _startPosX -= (int)EntityAirFighter.Step(); + } + return true; + case Up: + if (_startPosY - EntityAirFighter.Step() > 0) { + _startPosY -= (int)EntityAirFighter.Step(); + } + return true; + case Right: + if (_startPosX + EntityAirFighter.Step() + _drawningPlaneWidth < _pictureWidth) { + _startPosX += (int)EntityAirFighter.Step(); + } + return true; + case Down: + if (_startPosY + EntityAirFighter.Step() + _drawningPlaneHeight < _pictureHeight) { + _startPosY += (int)EntityAirFighter.Step(); + } + return true; + default: + return false; + } + } + public void DrawTransport(Graphics2D g) { + if (EntityAirFighter == null || _startPosX == null || _startPosY == null) { + return; + } + g.setColor(Color.BLACK); + int[] pointX = {_startPosX, _startPosX + 20, _startPosX + 20, _startPosX}; + int[] pointY = {_startPosY + 75, _startPosY + 70, _startPosY + 80, _startPosY + 75}; + Polygon triangle = new Polygon(pointX, pointY, 4); + g.fillPolygon(triangle); + + g.setColor(EntityAirFighter.getBodyColor()); + g.fillRect(_startPosX + 20, _startPosY + 70, 130, 10); + + g.drawLine(_startPosX + 40, _startPosY + 70, _startPosX + 40, _startPosY); + g.drawLine(_startPosX + 40, _startPosY, _startPosX + 50, _startPosY); + g.drawLine(_startPosX + 50, _startPosY, _startPosX + 55, _startPosY + 70); + g.drawLine(_startPosX + 40, _startPosY + 80, _startPosX + 40, _startPosY + 150); + g.drawLine(_startPosX + 40, _startPosY + 150, _startPosX + 50, _startPosY + 150); + g.drawLine(_startPosX + 50, _startPosY + 150, _startPosX + 55, _startPosY + 80); + + g.drawLine(_startPosX + 150, _startPosY + 70, _startPosX + 150, _startPosY + 55); + g.drawLine(_startPosX + 150, _startPosY + 55, _startPosX + 135, _startPosY + 65); + g.drawLine(_startPosX + 135, _startPosY + 65, _startPosX + 135, _startPosY + 70); + g.drawLine(_startPosX + 150, _startPosY + 80, _startPosX + 150, _startPosY + 95); + g.drawLine(_startPosX + 150, _startPosY + 95, _startPosX + 135, _startPosY + 85); + g.drawLine(_startPosX + 135, _startPosY + 85, _startPosX + 135, _startPosY + 80); + + DrawningEngines.DrawEngines(g, EntityAirFighter.getAdditionalColor(), _startPosX, _startPosY); + g.setColor(EntityAirFighter.getAdditionalColor()); + + if (EntityAirFighter.getExtraWings()) { + g.drawLine(_startPosX + 65, _startPosY + 70, _startPosX + 90, _startPosY + 20); + g.drawLine(_startPosX + 90, _startPosY + 20, _startPosX + 110, _startPosY + 20); + g.drawLine(_startPosX + 110, _startPosY + 20, _startPosX + 85, _startPosY + 70); + g.drawLine(_startPosX + 65, _startPosY + 80, _startPosX + 90, _startPosY + 130); + g.drawLine(_startPosX + 90, _startPosY + 130, _startPosX + 110, _startPosY + 130); + g.drawLine(_startPosX + 110, _startPosY + 130, _startPosX + 85, _startPosY + 80); + } + + if (EntityAirFighter.getRockets()) { + g.fillRect(_startPosX + 32, _startPosY + 4, 8, 6); + g.drawLine(_startPosX + 32, _startPosY + 4, _startPosX + 26, _startPosY + 7); + g.drawLine(_startPosX + 26, _startPosY + 7, _startPosX + 32, _startPosY + 10); + g.fillRect(_startPosX + 32, _startPosY + 140, 8, 6); + g.drawLine(_startPosX + 32, _startPosY + 146, _startPosX + 26, _startPosY + 143); + g.drawLine(_startPosX + 26, _startPosY + 143, _startPosX + 32, _startPosY + 140); + } + } +} \ No newline at end of file diff --git a/ProjectAirFighter/src/DrawningEngines.java b/ProjectAirFighter/src/DrawningEngines.java new file mode 100644 index 0000000..4fa58a8 --- /dev/null +++ b/ProjectAirFighter/src/DrawningEngines.java @@ -0,0 +1,27 @@ +import java.awt.*; + +public class DrawningEngines { + private CountEngines CountEngines; + public CountEngines getCountEngines() { + return CountEngines; + } + private EntityAirFighter EntityAirFighter; + public void SetCountEngines(int countEngines) { + for (CountEngines num : CountEngines.values()) { + if (num.getCount() == countEngines) { + CountEngines = num; + return; + } + } + } + public DrawningEngines(EntityAirFighter entityAirFighter) { + EntityAirFighter = entityAirFighter; + } + public void DrawEngines(Graphics2D g, Color color, int x, int y) { + g.setColor(color); + for (int i = CountEngines.getCount(); i > 0; i -= 2) { + g.fillOval(x + 35, y + 10 * i - 5, 10, 10); + g.fillOval(x + 35, y + 145 - 10 * i, 10, 10); + } + } +} \ No newline at end of file diff --git a/ProjectAirFighter/src/EntityAirFighter.java b/ProjectAirFighter/src/EntityAirFighter.java new file mode 100644 index 0000000..b2edd9e --- /dev/null +++ b/ProjectAirFighter/src/EntityAirFighter.java @@ -0,0 +1,39 @@ +import java.awt.*; + +public class EntityAirFighter { + private int Speed; + public int getSpeed() { + return Speed; + } + private double Weight; + public double getWeight() { + return Weight; + } + private Color BodyColor; + public Color getBodyColor() { + return BodyColor; + } + private Color AdditionalColor; + public Color getAdditionalColor() { + return AdditionalColor; + } + private boolean ExtraWings; + public boolean getExtraWings() { + return ExtraWings; + } + private boolean Rockets; + public boolean getRockets() { + return Rockets; + } + public double Step() { + return Speed * 100 / Weight; + } + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean extraWings, boolean rockets) { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + ExtraWings = extraWings; + Rockets = rockets; + } +} \ No newline at end of file diff --git a/ProjectAirFighter/src/FormAirFighter.form b/ProjectAirFighter/src/FormAirFighter.form new file mode 100644 index 0000000..8312a9e --- /dev/null +++ b/ProjectAirFighter/src/FormAirFighter.form @@ -0,0 +1,97 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/ProjectAirFighter/src/FormAirFighter.java b/ProjectAirFighter/src/FormAirFighter.java new file mode 100644 index 0000000..c83e744 --- /dev/null +++ b/ProjectAirFighter/src/FormAirFighter.java @@ -0,0 +1,105 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.LinkedList; +import java.util.Random; +import java.util.List; + +public class FormAirFighter { + JPanel mainBox; + private JPanel pictureBoxAirFighter; + private JButton buttonCreateAirFighter; + private JButton buttonLeft; + private JButton buttonUp; + private JButton buttonDown; + private JButton buttonRight; + private DrawningAirFighter _drawningAirFighter = new DrawningAirFighter(); + private List controls; + public FormAirFighter() { + buttonUp.setName("buttonUp"); + buttonDown.setName("buttonDown"); + buttonLeft.setName("buttonLeft"); + buttonRight.setName("buttonRight"); + + InitializeControlsRepaintList(); + + buttonCreateAirFighter.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + _drawningAirFighter = new DrawningAirFighter(); + Random random = new Random(); + _drawningAirFighter.Init(random.nextInt(300) + 300, + random.nextInt(1500) + 1500, + new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256)), + new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256)), + random.nextBoolean(), random.nextBoolean() ); + _drawningAirFighter.SetPictureSize(pictureBoxAirFighter.getWidth(), pictureBoxAirFighter.getHeight()); + _drawningAirFighter.SetPosition(random.nextInt(100), random.nextInt(100)); + + Draw(); + } + }); + ActionListener buttonMoveClickedListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String buttonName = ((JButton) e.getSource()).getName(); + boolean result = false; + + switch (buttonName) { + case "buttonUp": { + result = _drawningAirFighter.MoveTransport(DirectionType.Up); + } + break; + case "buttonDown": { + result = _drawningAirFighter.MoveTransport(DirectionType.Down); + } + break; + case "buttonLeft": { + result = _drawningAirFighter.MoveTransport(DirectionType.Left); + } + break; + case "buttonRight": { + result = _drawningAirFighter.MoveTransport(DirectionType.Right); + } + break; + + }; + + if (result) { + Draw(); + }; + }; + }; + buttonRight.addActionListener(buttonMoveClickedListener); + buttonDown.addActionListener(buttonMoveClickedListener); + buttonLeft.addActionListener(buttonMoveClickedListener); + buttonUp.addActionListener(buttonMoveClickedListener); + + } + private void Draw() { + if (_drawningAirFighter == null) { + return; + } + Graphics g = pictureBoxAirFighter.getGraphics(); + g.setColor(pictureBoxAirFighter.getBackground()); + g.fillRect(0,0, pictureBoxAirFighter.getWidth(), pictureBoxAirFighter.getHeight()); + _drawningAirFighter.DrawTransport((Graphics2D) g); + + RepaintControls(); + } + private void RepaintControls() { + for (JComponent control : controls) { + control.repaint(); + } + } + + private void InitializeControlsRepaintList() { + controls = new LinkedList<>(); + controls.add(buttonCreateAirFighter); + controls.add(buttonUp); + controls.add(buttonDown); + controls.add(buttonLeft); + controls.add(buttonRight); + } +} \ No newline at end of file diff --git a/ProjectAirFighter/src/Main.java b/ProjectAirFighter/src/Main.java new file mode 100644 index 0000000..fa04037 --- /dev/null +++ b/ProjectAirFighter/src/Main.java @@ -0,0 +1,14 @@ +import javax.swing.*; + +public class Main { + public static void main(String[] args) { + JFrame.setDefaultLookAndFeelDecorated(false); + JFrame frame = new JFrame("FormSeaplane"); + frame.setContentPane(new FormAirFighter().mainBox); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocation(500, 200); + frame.pack(); + frame.setSize(1000, 500); + frame.setVisible(true); + } +} \ No newline at end of file -- 2.25.1 From a15eaf4b35be55017ccea3756493746d3bf8999c Mon Sep 17 00:00:00 2001 From: VirBiuM Date: Mon, 25 Mar 2024 14:17:41 +0400 Subject: [PATCH 2/3] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20=D0=B4=D0=BE=D0=BF=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectAirFighter/src/CountEngines.java | 4 +--- ProjectAirFighter/src/DrawningAirFighter.java | 2 +- ProjectAirFighter/src/DrawningEngines.java | 9 ++------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/ProjectAirFighter/src/CountEngines.java b/ProjectAirFighter/src/CountEngines.java index 495ac36..cf1a723 100644 --- a/ProjectAirFighter/src/CountEngines.java +++ b/ProjectAirFighter/src/CountEngines.java @@ -4,9 +4,7 @@ public enum CountEngines { Four(4), Six(6); private int Count; - public int getCount() { - return Count; - } + public int getCount() { return Count; } CountEngines(int num){ this.Count = num; } diff --git a/ProjectAirFighter/src/DrawningAirFighter.java b/ProjectAirFighter/src/DrawningAirFighter.java index 7eda438..efc6a50 100644 --- a/ProjectAirFighter/src/DrawningAirFighter.java +++ b/ProjectAirFighter/src/DrawningAirFighter.java @@ -20,7 +20,7 @@ public class DrawningAirFighter { _pictureHeight = null; _startPosX = null; _startPosY = null; - DrawningEngines = new DrawningEngines(EntityAirFighter); + DrawningEngines = new DrawningEngines(); Random random = new Random(); int Count = 2 * random.nextInt(4); DrawningEngines.SetCountEngines(Count); diff --git a/ProjectAirFighter/src/DrawningEngines.java b/ProjectAirFighter/src/DrawningEngines.java index 4fa58a8..a25e1ed 100644 --- a/ProjectAirFighter/src/DrawningEngines.java +++ b/ProjectAirFighter/src/DrawningEngines.java @@ -2,21 +2,16 @@ import java.awt.*; public class DrawningEngines { private CountEngines CountEngines; - public CountEngines getCountEngines() { - return CountEngines; - } + private EntityAirFighter EntityAirFighter; public void SetCountEngines(int countEngines) { for (CountEngines num : CountEngines.values()) { if (num.getCount() == countEngines) { CountEngines = num; - return; } } } - public DrawningEngines(EntityAirFighter entityAirFighter) { - EntityAirFighter = entityAirFighter; - } + public void DrawEngines(Graphics2D g, Color color, int x, int y) { g.setColor(color); for (int i = CountEngines.getCount(); i > 0; i -= 2) { -- 2.25.1 From 386e4d325111903fb7d141686daee5175ecebcd2 Mon Sep 17 00:00:00 2001 From: VirBiuM Date: Mon, 25 Mar 2024 14:19:36 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20=D0=B4=D0=BE=D0=BF=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectAirFighter/src/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectAirFighter/src/Main.java b/ProjectAirFighter/src/Main.java index fa04037..1474401 100644 --- a/ProjectAirFighter/src/Main.java +++ b/ProjectAirFighter/src/Main.java @@ -3,7 +3,7 @@ import javax.swing.*; public class Main { public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(false); - JFrame frame = new JFrame("FormSeaplane"); + JFrame frame = new JFrame("Истребитель"); frame.setContentPane(new FormAirFighter().mainBox); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(500, 200); -- 2.25.1