28 lines
787 B
Java
28 lines
787 B
Java
package Drawnings;
|
|
|
|
import java.awt.*;
|
|
|
|
public class DrawningWheels implements IDrawWheels {
|
|
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++) {
|
|
g2d.drawOval(_startX + 5 + i * wheelDistance, _startY + 46, 8, 8);
|
|
}
|
|
}
|
|
}
|