From 4ff33ecdf2f2dddaf7cce69c67ab2e1dddcb2501 Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Thu, 26 Oct 2023 23:45:53 +0400 Subject: [PATCH] some minor fixes --- src/Main.java | 2 ++ src/{ => drawing_objects}/DrawingBattleship.java | 9 ++++++++- src/{ => drawing_objects}/DrawingBlocks.java | 4 ++++ src/{ => entities}/EntityBattleship.java | 2 ++ src/{ => enums}/BlocksNumber.java | 2 ++ src/{ => enums}/DirectionType.java | 2 ++ src/{ => frames}/FrameBattleship.java | 6 ++++++ 7 files changed, 26 insertions(+), 1 deletion(-) rename src/{ => drawing_objects}/DrawingBattleship.java (96%) rename src/{ => drawing_objects}/DrawingBlocks.java (94%) rename src/{ => entities}/EntityBattleship.java (98%) rename src/{ => enums}/BlocksNumber.java (76%) rename src/{ => enums}/DirectionType.java (79%) rename src/{ => frames}/FrameBattleship.java (98%) diff --git a/src/Main.java b/src/Main.java index c292ed4..df6f25c 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,3 +1,5 @@ +import frames.FrameBattleship; + import java.io.IOException; public class Main { diff --git a/src/DrawingBattleship.java b/src/drawing_objects/DrawingBattleship.java similarity index 96% rename from src/DrawingBattleship.java rename to src/drawing_objects/DrawingBattleship.java index 2f25a3c..00623af 100644 --- a/src/DrawingBattleship.java +++ b/src/drawing_objects/DrawingBattleship.java @@ -1,3 +1,8 @@ +package drawing_objects; + +import entities.EntityBattleship; +import enums.DirectionType; + import java.awt.*; public class DrawingBattleship { @@ -86,7 +91,9 @@ public class DrawingBattleship { graphics2D.drawRect(startPosX + 70, startPosY + 12, 18, 26); graphics2D.drawOval(startPosX + 94, startPosY + 19, 12, 12); //блоки - drawingBlocks.drawBlocks(graphics2D, startPosX, startPosY); + if (drawingBlocks != null){ + drawingBlocks.drawBlocks(graphics2D, startPosX, startPosY); + } //орудийная башня if (entityBattleship.getTurret()) { int[] shieldX = new int[] {startPosX + 112, startPosX + 112, startPosX + 119, startPosX + 119, }; diff --git a/src/DrawingBlocks.java b/src/drawing_objects/DrawingBlocks.java similarity index 94% rename from src/DrawingBlocks.java rename to src/drawing_objects/DrawingBlocks.java index 392f00d..6c6ad21 100644 --- a/src/DrawingBlocks.java +++ b/src/drawing_objects/DrawingBlocks.java @@ -1,3 +1,7 @@ +package drawing_objects; + +import enums.BlocksNumber; + import java.awt.*; public class DrawingBlocks { diff --git a/src/EntityBattleship.java b/src/entities/EntityBattleship.java similarity index 98% rename from src/EntityBattleship.java rename to src/entities/EntityBattleship.java index a511cd1..af40718 100644 --- a/src/EntityBattleship.java +++ b/src/entities/EntityBattleship.java @@ -1,3 +1,5 @@ +package entities; + import java.awt.*; import java.util.function.Supplier; diff --git a/src/BlocksNumber.java b/src/enums/BlocksNumber.java similarity index 76% rename from src/BlocksNumber.java rename to src/enums/BlocksNumber.java index 56eb9b7..7233e2a 100644 --- a/src/BlocksNumber.java +++ b/src/enums/BlocksNumber.java @@ -1,3 +1,5 @@ +package enums; + public enum BlocksNumber { TWO, FOUR, diff --git a/src/DirectionType.java b/src/enums/DirectionType.java similarity index 79% rename from src/DirectionType.java rename to src/enums/DirectionType.java index 0d664bb..1f59378 100644 --- a/src/DirectionType.java +++ b/src/enums/DirectionType.java @@ -1,3 +1,5 @@ +package enums; + public enum DirectionType { UP, DOWN, diff --git a/src/FrameBattleship.java b/src/frames/FrameBattleship.java similarity index 98% rename from src/FrameBattleship.java rename to src/frames/FrameBattleship.java index df6b3b5..7236810 100644 --- a/src/FrameBattleship.java +++ b/src/frames/FrameBattleship.java @@ -1,3 +1,8 @@ +package frames; + +import drawing_objects.DrawingBattleship; +import enums.DirectionType; + import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; @@ -5,6 +10,7 @@ import java.awt.event.ActionEvent; import java.io.File; import java.io.IOException; import java.util.Random; + public class FrameBattleship extends JFrame { private DrawingBattleship drawingBattleship; private JComponent pictureBox;