package laba1Loco; import java.awt.*; import java.util.*; import javax.swing.*; import javax.swing.Timer; import java.awt.event.*; public class WheelDrawingSimple implements IWheelDrawing{ private NumWheel numWheel; public NumWheel getNumWheel() { return numWheel; } public void setNumWheel(int kwheel){ switch(kwheel){ case 2: numWheel = NumWheel.TwoWheel; break; case 3: numWheel = NumWheel.ThreeWheel; break; case 4: numWheel = NumWheel.FourWheel; break; default: numWheel = NumWheel.TwoWheel; System.out.println("ВСё плохо, колво колёс почему то не соответтвовало критериям, количество колёс:" + Integer.toString(kwheel) + "но вывели мы как будто их было 2"); break; } } public void Draw(int _startPosX, int _startPosY, boolean fuelTank, Color color, Graphics2D g2d){ g2d.setColor(color); g2d.fillOval(_startPosX + 3, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 26, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 46, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 72, _startPosY + 34, 8, 8); if (numWheel == NumWheel.ThreeWheel){ g2d.fillOval(_startPosX + 14, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 59, _startPosY + 34, 8, 8); } if (numWheel == NumWheel.FourWheel){ g2d.fillOval(_startPosX + 11, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 18, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 55, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 63, _startPosY + 34, 8, 8); } if (fuelTank){ g2d.fillOval(_startPosX + 3+85, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 26+85, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 46+85, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 72+85, _startPosY + 34, 8, 8); if (numWheel == NumWheel.ThreeWheel){ g2d.fillOval(_startPosX + 14+85, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 59+85, _startPosY + 34, 8, 8); } if (numWheel == NumWheel.FourWheel){ g2d.fillOval(_startPosX + 11+85, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 18+85, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 55+85, _startPosY + 34, 8, 8); g2d.fillOval(_startPosX + 63+85, _startPosY + 34, 8, 8); } } } }