36 lines
972 B
Java
36 lines
972 B
Java
|
package ProjectElectricLocomotive;
|
||
|
|
||
|
import java.awt.*;
|
||
|
|
||
|
public class DrawingWheelsBlueCrom implements IDrawingWheels{
|
||
|
private WheelsCount _wheelsCount;
|
||
|
@Override
|
||
|
public void SetWheelsCount(int wheelsCount) {
|
||
|
for (WheelsCount val : WheelsCount.values()) {
|
||
|
if (val.count == wheelsCount) {
|
||
|
_wheelsCount = val;
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
this._wheelsCount = WheelsCount.Three;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public WheelsCount GetWheelsCount() {
|
||
|
return _wheelsCount;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void DrawWheel(Graphics2D g2d, Color color, int x, int y, int w, int h) {
|
||
|
g2d.setColor(Color.BLUE);
|
||
|
g2d.drawOval(x, y + 3, w + 2, h + 2);
|
||
|
g2d.setColor(Color.RED);
|
||
|
g2d.drawOval(x - 2, y - 2, w + 2, h + 2);
|
||
|
g2d.setColor(Color.MAGENTA);
|
||
|
g2d.drawOval(x + 3, y, w + 3, h + 3);
|
||
|
|
||
|
g2d.setColor(Color.BLACK);
|
||
|
g2d.drawOval(x, y, w, h);
|
||
|
}
|
||
|
}
|