import java.awt.*; public class DrawingEngines { private DirectionEnginesOnStormtrooper enginesCount; public void SetNewEngines(int countEngines){ if (countEngines == 4) { enginesCount = DirectionEnginesOnStormtrooper.FOUR; } else if (countEngines == 6) { enginesCount = DirectionEnginesOnStormtrooper.SIX; } else { enginesCount = DirectionEnginesOnStormtrooper.TWO; } } public void Draw(Graphics2D g, int x, int y, Color color) { g.setColor(color != null ? color : Color.BLACK); switch (enginesCount) { case TWO: g.fillRect(x + 50, y, 20, 5); g.fillRect(x + 50, y+95, 20, 5); break; case FOUR: g.fillRect(x + 50, y, 20, 5); g.fillRect(x + 50, y+10, 20, 5); g.fillRect(x + 50, y+85, 20, 5); g.fillRect(x + 50, y+95, 20, 5); break; case SIX: g.fillRect(x + 50, y, 20, 5); g.fillRect(x + 50, y+10, 20, 5); g.fillRect(x + 50, y+20, 20, 5); g.fillRect(x + 50, y+75, 20, 5); g.fillRect(x + 50, y+85, 20, 5); g.fillRect(x + 50, y+95, 20, 5); break; } } }