From 9d0594068b40b24f0ff0ece84b448fc43a60cd45 Mon Sep 17 00:00:00 2001 From: AnnaLioness Date: Fri, 3 Nov 2023 23:38:13 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=B8=D0=BC=D0=BE=D1=80?= =?UTF-8?q?=D1=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrawingContainerShip.java | 3 --- DrawingShip.java | 4 +--- NewFormRand.java | 14 +++++++------- ShipGenericCollection.java | 17 ----------------- ShipGenericDop.java | 4 ++-- 5 files changed, 10 insertions(+), 32 deletions(-) diff --git a/DrawingContainerShip.java b/DrawingContainerShip.java index fc8c2a2..07a3750 100644 --- a/DrawingContainerShip.java +++ b/DrawingContainerShip.java @@ -2,9 +2,6 @@ import java.awt.*; public class DrawingContainerShip extends DrawingShip{ - - - private IDecksDrawing iDecksDrawing; public DrawingContainerShip(int speed, double weight, Color bodyColor, Color diff --git a/DrawingShip.java b/DrawingShip.java index 79f9bc7..8eee8f2 100644 --- a/DrawingShip.java +++ b/DrawingShip.java @@ -125,9 +125,7 @@ public class DrawingShip { { return; } - //Pen pen = new Pen(Color.Black); - //Brush adbrush = new SolidBrush(EntityContainerShip.AdditionalColor); - //Brush brBlue = new SolidBrush(Color.Blue); + g.setPaint(EntityShip.BodyColor); // заполнение борта int x[] = {_startPosX+ 20, _startPosX+40, _startPosX+110, _startPosX+130, _startPosX+ 20}; diff --git a/NewFormRand.java b/NewFormRand.java index f34bc3c..322926a 100644 --- a/NewFormRand.java +++ b/NewFormRand.java @@ -27,13 +27,13 @@ public class NewFormRand extends JFrame { setLayout(null); _ShipGenericDop = new ShipGenericDop<>(50,50,pictureBoxWidth,pictureBoxHeight); canv.setBounds(0, 0, pictureBoxWidth, pictureBoxHeight); - _ShipGenericDop.AddShip(new EntityShip(200,200,Color.PINK)); - _ShipGenericDop.AddShip(new EntityShip(200,200,Color.GRAY)); - _ShipGenericDop.AddShip(new EntityContainerShip(200, 200, Color.GREEN, Color.BLUE, true, false, 2, 1)); - _ShipGenericDop.AddShip(new EntityContainerShip(200, 200, Color.LIGHT_GRAY, Color.MAGENTA, false, true, 3, 3)); - _ShipGenericDop.AddDeck(new DrawingDecks()); - _ShipGenericDop.AddDeck(new DrawingDecksRect()); - _ShipGenericDop.AddDeck(new DrawingDecksTrapez()); + _ShipGenericDop.Add(new EntityShip(200,200,Color.PINK)); + _ShipGenericDop.Add(new EntityShip(200,200,Color.GRAY)); + _ShipGenericDop.Add(new EntityContainerShip(200, 200, Color.GREEN, Color.BLUE, true, false, 2, 1)); + _ShipGenericDop.Add(new EntityContainerShip(200, 200, Color.LIGHT_GRAY, Color.MAGENTA, false, true, 3, 3)); + _ShipGenericDop.Add(new DrawingDecks()); + _ShipGenericDop.Add(new DrawingDecksRect()); + _ShipGenericDop.Add(new DrawingDecksTrapez()); JButton creatButton = new JButton("создать"); creatButton.addActionListener( new ActionListener() { diff --git a/ShipGenericCollection.java b/ShipGenericCollection.java index 29b8ab9..1dc692b 100644 --- a/ShipGenericCollection.java +++ b/ShipGenericCollection.java @@ -23,14 +23,6 @@ public class ShipGenericCollection(width * height); } - /*public static int operator +(ShipGenericCollection collect, T obj) - { - if (obj == null) - { - return -1; - } - return collect?._collection.Insert(obj) ?? -1; - }*/ public int Add(T obj) { if (obj == null) @@ -40,15 +32,6 @@ public class ShipGenericCollection collect, int pos) - { - T obj = collect._collection.Get(pos); - if (obj != null) - { - return collect._collection.Remove(pos); - } - return false; - }*/ public T remove(int pos) { T obj = _collection.Get(pos); diff --git a/ShipGenericDop.java b/ShipGenericDop.java index 585f5ed..d5e7722 100644 --- a/ShipGenericDop.java +++ b/ShipGenericDop.java @@ -21,7 +21,7 @@ public class ShipGenericDop { _pictureHeight = pictureHeight; rand = new Random(); } - public boolean AddShip(T ship){ + public boolean Add(T ship){ if(ship == null){ return false; } @@ -31,7 +31,7 @@ public class ShipGenericDop { Ships.add(countShips++, ship); return true; } - public boolean AddDeck(U deck){ + public boolean Add(U deck){ if(deck == null){ return false; }