36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
import java.awt.*;
|
|
|
|
public class NumberOfWheels implements IDop{
|
|
public int numOfWheels;
|
|
public NumberOfWheels(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) {
|
|
g.fillOval(_startPosX, _startPosY + 35 + 10, 15, 15);
|
|
g.fillOval(_startPosX + 95, _startPosY + 35 + 10, 15, 15);
|
|
} if (numOfWheels >= 3) {
|
|
g.fillOval(_startPosX + 15, _startPosY + 35 + 10, 15, 15);
|
|
} if(numOfWheels >= 4){
|
|
g.fillOval(_startPosX + 95 - 20, _startPosY + 35 + 10, 15, 15);
|
|
}
|
|
}
|
|
}
|