diff --git a/DrawningLocomotive.java b/DrawningLocomotive.java index bc3cbef..ae45dbd 100644 --- a/DrawningLocomotive.java +++ b/DrawningLocomotive.java @@ -110,7 +110,7 @@ class DrawningLocomotive { g.setColor(Color.BLACK); g.drawRect( (int)_startPosX + 50, (int)_startPosY + 10, 10, 20); //колеса - extraWheelsDraw.DrawWheels((int)_startPosX, (int)_startPosY, g); + extraWheelsDraw.DrawExtra((int)_startPosX, (int)_startPosY, g); //движок g.setColor(Locomotive.getBodyColor()); g.fillRect((int)_startPosX + 100, (int)_startPosY + 10, 10, 30); diff --git a/DrawningWarmlyLocomotive.java b/DrawningWarmlyLocomotive.java index bc5cc09..f7fd094 100644 --- a/DrawningWarmlyLocomotive.java +++ b/DrawningWarmlyLocomotive.java @@ -23,7 +23,7 @@ public class DrawningWarmlyLocomotive extends DrawningLocomotive{ if (warmlyLocomotive.FuelStorage) { - g.fillRect((int)_startPosX + 110, (int)_startPosY + 10, 10, 50); + g.fillRect((int)_startPosX + 120, (int)_startPosY + 10, 10, 50); g.fillRect((int)_startPosX + 110, (int)_startPosY + 40, 20, 20); g.fillRect((int)_startPosX + 110, (int)_startPosY, 30, 10); } diff --git a/ExtraWheelsDraw.java b/ExtraWheelsDraw.java index 551b428..abe9d15 100644 --- a/ExtraWheelsDraw.java +++ b/ExtraWheelsDraw.java @@ -1,8 +1,8 @@ import java.awt.*; -public class ExtraWheelsDraw { +public class ExtraWheelsDraw implements IDrawningExtra{ private WheelsCount wheelsCount = WheelsCount.Two; - public void setWheelsNum(int num) { + public void setExtraNum(int num) { switch (num) { case 0: { wheelsCount = WheelsCount.Three; @@ -19,11 +19,11 @@ public class ExtraWheelsDraw { private Color color; public ExtraWheelsDraw(int num, Color color) { - setWheelsNum(num); + setExtraNum(num); this.color = color; } - public void DrawWheels(int startPosX, int startPosY, Graphics2D g) { + public void DrawExtra(int startPosX, int startPosY, Graphics2D g) { g.setColor(color); g.drawOval(startPosX, startPosY + 40, 10, 10); g.drawOval(startPosX + 90, startPosY + 40, 10, 10); diff --git a/IDrawningExtra.java b/IDrawningExtra.java new file mode 100644 index 0000000..725e87a --- /dev/null +++ b/IDrawningExtra.java @@ -0,0 +1,6 @@ +import java.awt.*; + +public interface IDrawningExtra { + void setExtraNum(int num); + void DrawExtra(int startPosX, int startPosY, Graphics2D g); +}