package ProjectElectricLocomotive; import java.awt.*; public interface IDrawingWheels { void SetWheelsCount(int wheelsCount); WheelsCount GetWheelsCount(); void DrawWheel(Graphics2D g2d, Color color, int x, int y, int w, int h); default void DrawWheels(Graphics g, Color color, int startPosX, int startPosY, int drawingWidth, int drawingHeight){ WheelsCount wheelsCount = GetWheelsCount(); if(wheelsCount == null) return; Graphics2D g2d = (Graphics2D) g; int wheelWidth = 9; int wheelHeight = 9; if(wheelsCount.count <= wheelsCount.Two.count){ DrawWheel(g2d, color, startPosX + 95, startPosY + 45, 9, 9); DrawWheel(g2d, color, startPosX + 140, startPosY + 45, 9, 9); } if (wheelsCount.count == wheelsCount.Three.count) { DrawWheel(g2d, color, startPosX + 95, startPosY + 45, 9, 9); DrawWheel(g2d, color, startPosX + 140, startPosY + 45, 9, 9); DrawWheel(g2d, color, startPosX + 105, startPosY + 45, wheelWidth, wheelHeight); } if (wheelsCount.count == wheelsCount.Four.count) { DrawWheel(g2d, color, startPosX + 95, startPosY + 45, 9, 9); DrawWheel(g2d, color, startPosX + 140, startPosY + 45, 9, 9); DrawWheel(g2d, color, startPosX + 105, startPosY + 45, wheelWidth, wheelHeight); DrawWheel(g2d, color, startPosX + 130, startPosY + 45, wheelWidth, wheelHeight); } } }