From 1c92c5b0ebacea40fe07529f30a94463f4e20a45 Mon Sep 17 00:00:00 2001 From: devil_1nc Date: Tue, 8 Nov 2022 14:55:22 +0400 Subject: [PATCH] com3 --- DopIlum.java | 3 +++ DrawingIlum.java | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 DopIlum.java create mode 100644 DrawingIlum.java diff --git a/DopIlum.java b/DopIlum.java new file mode 100644 index 0000000..fee8318 --- /dev/null +++ b/DopIlum.java @@ -0,0 +1,3 @@ +enum DopIlum { + Ten, Twenty, Thirty +} diff --git a/DrawingIlum.java b/DrawingIlum.java new file mode 100644 index 0000000..b96bcac --- /dev/null +++ b/DrawingIlum.java @@ -0,0 +1,49 @@ +import java.awt.*; + +public class DrawingIlum { + private DopIlum il = DopIlum.Ten; + public void setIl(int num){ + switch(num) + { + case 0: + il = DopIlum.Twenty; + break; + case 1: + il = DopIlum.Thirty; + break; + default: + break; + } + + } + private Color color; + + public void Init(int num, Color color) { + setIl(num); + this.color = color; + } + public void DrawIl(int startPosX, int startPosY, Graphics2D g) { + + g.setColor(Color.blue); + for (int tempX = 98; tempX > 38; tempX -= 6) { + g.fillOval((int) startPosX + tempX, (int) startPosY + 20, 4, 4); + } + switch (il) { + case Twenty: { + for (int tempX = 98; tempX > 38; tempX -= 6) { + g.fillOval((int) startPosX + tempX, (int) startPosY + 26, 4, 4); + } + break; + } + case Thirty: { + for (int tempX = 98; tempX > 38; tempX -= 6) { + g.fillOval((int) startPosX + tempX, (int) startPosY + 25, 4, 4); + g.fillOval((int) startPosX + tempX, (int) startPosY + 30, 4, 4); + } + break; + } + default: + break; + } + } +}