Pibd-14_Boyko_M.S._ElectroT.../ProjectElectroTrans/Drawnings/DrawningWheels.java

28 lines
787 B
Java
Raw Normal View History

2024-03-28 10:46:56 +04:00
package Drawnings;
import java.awt.*;
2024-04-25 10:39:26 +04:00
public class DrawningWheels implements IDrawWheels {
2024-03-28 10:46:56 +04:00
private WheelsCount wheelsCount;
@Override
public void setNumber(int wheelCount) {
for (WheelsCount value : WheelsCount.values()) {
if (value.getEnumNumber() == wheelCount) {
wheelsCount = value;
return;
}
}
}
@Override
public void drawWheels(Graphics2D g2d, Color color, int _startX, int _startY) {
g2d.setColor(color);
g2d.setStroke(new BasicStroke(4));
int wheelDistance = 100 / wheelsCount.getEnumNumber();
for (int i = 0; i < wheelsCount.getEnumNumber(); i++) {
2024-04-25 10:39:26 +04:00
g2d.drawOval(_startX + 5 + i * wheelDistance, _startY + 46, 8, 8);
2024-03-28 10:46:56 +04:00
}
}
}