From 7c1dbb37517dd6169792ca236deea594eae2fbda Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Sun, 17 Dec 2023 17:18:04 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20ExtensionDrawingPlane?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExtensionDrawingPlane.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 ProjectStormtrooper/ExtensionDrawingPlane.java diff --git a/ProjectStormtrooper/ExtensionDrawingPlane.java b/ProjectStormtrooper/ExtensionDrawingPlane.java new file mode 100644 index 0000000..c1d21ce --- /dev/null +++ b/ProjectStormtrooper/ExtensionDrawingPlane.java @@ -0,0 +1,31 @@ +package ProjectStormtrooper; + +import java.awt.*; + +public class ExtensionDrawingPlane { + public static DrawingPlane CreateDrawingPlane(String info, String separatorForObject, int width, int height) { + String[] strs = info.split(separatorForObject); + if (strs.length == 3) + { + return new DrawingPlane( + Integer.parseInt(strs[0]), + Integer.parseInt(strs[1]), + Color.getColor(strs[2]), + width, height + ); + } + if (strs.length == 6) + { + return new DrawingStormtrooper( + Integer.parseInt(strs[0]), + Integer.parseInt(strs[1]), + Color.getColor(strs[2]), + Color.getColor(strs[3]), + Boolean.parseBoolean(strs[4]), + Boolean.parseBoolean(strs[5]), + width, height + ); + } + return null; + } +}