PIbd-21_Bakalskaya_E.D._Ele.../ProjectElectricLocomotive/DrawingWheelsBlueCrom.java

36 lines
972 B
Java
Raw Normal View History

2023-10-10 01:30:20 +04:00
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);
}
}