PIbd-23_Mochalov_D.V._Locom.../ExtraWheelsDraw.java

44 lines
1.1 KiB
Java

import java.awt.*;
public class ExtraWheelsDraw implements IDrawningExtra{
private WheelsCount wheelsCount = WheelsCount.Two;
public void setExtraNum(int num) {
switch (num) {
case 0: {
wheelsCount = WheelsCount.Three;
break;
}
case 1: {
wheelsCount = WheelsCount.Four;
break;
}
default:
break;
}
}
private Color color;
public ExtraWheelsDraw(int num, Color color) {
setExtraNum(num);
this.color = color;
}
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);
switch (wheelsCount) {
case Four: {
g.drawOval(startPosX + 70, startPosY + 40, 10, 10);
}
case Three: {
g.drawOval(startPosX + 20, startPosY + 40, 10, 10);
break;
}
default:
break;
}
}
}