34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
|
import java.awt.*;
|
||
|
public class DopClassMixed implements IDop{
|
||
|
public int numOfWheels;
|
||
|
public DopClassMixed(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.fillRect(_startPosX+55, _startPosY+20, 20, 15);
|
||
|
g.fillRect(_startPosX+55, _startPosY+40, 20, 15);
|
||
|
} if (numOfWheels >= 3) {
|
||
|
g.fillOval(_startPosX+30, _startPosY+20, 20, 15);
|
||
|
} if (numOfWheels >= 4) {
|
||
|
g.fillRect(_startPosX+85, _startPosY+20, 20, 15);
|
||
|
}
|
||
|
}
|
||
|
}
|