2023-12-08 23:20:53 +04:00
|
|
|
import java.awt.*;
|
|
|
|
public class DopClassRect implements IDop{
|
|
|
|
public int numOfWheels;
|
|
|
|
public DopClassRect(int num){
|
|
|
|
numOfWheels = num;
|
|
|
|
}
|
|
|
|
public void setNumOfWheels(String num){
|
|
|
|
switch (Integer.valueOf(num)){
|
|
|
|
case 2:
|
|
|
|
numOfWheels = NumberOfWheelsEnum.wheel_2.value;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
numOfWheels = NumberOfWheelsEnum.wheel_3.value;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
numOfWheels = NumberOfWheelsEnum.wheel_4.value;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
numOfWheels = NumberOfWheelsEnum.wheel_2.value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void drawWheels(Graphics g, int _startPosX, int _startPosY, Color c) {
|
|
|
|
g.setColor(c);
|
|
|
|
if (numOfWheels >= 2) {
|
2023-12-09 00:17:07 +04:00
|
|
|
g.fillRect(_startPosX+55, _startPosY+15, 20, 15);
|
|
|
|
g.fillRect(_startPosX+55, _startPosY+30, 20, 15);
|
2023-12-08 23:20:53 +04:00
|
|
|
} if (numOfWheels >= 3) {
|
2023-12-09 00:17:07 +04:00
|
|
|
g.fillRect(_startPosX+30, _startPosY+15, 20, 15);
|
2023-12-08 23:20:53 +04:00
|
|
|
} if (numOfWheels >= 4) {
|
2023-12-09 00:17:07 +04:00
|
|
|
g.fillRect(_startPosX + 60, _startPosY + 35, 15, 15);
|
2023-12-08 23:20:53 +04:00
|
|
|
}
|
|
|
|
}
|
2023-12-09 00:17:07 +04:00
|
|
|
}
|