Pibd-22_Presnyakova.V.V_Cat.../DrawningOvalOars.java
2022-12-05 11:12:21 +04:00

37 lines
985 B
Java

import java.awt.*;
public class DrawningOvalOars implements IDrawningOars{
private OarsCount _Oars;
@Override
public void SetOarsCount(int numOfOars) {
_Oars = OarsCount.GetOarsCount(numOfOars);
}
@Override
public void DrawOars(Graphics g, int _startPosX, int _startPosY) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.BLACK);
int numOfOars = 0;
switch (_Oars)
{
case One:
numOfOars = 1;
break;
case Two:
numOfOars = 2;
break;
case Three:
numOfOars = 3;
break;
}
for(int i = numOfOars; i >= 1; --i){
g2d.setColor(Color.CYAN);
g2d.fillOval(_startPosX + (15 * (i + 1)), _startPosY -15, 15, 15);
g2d.setColor(Color.BLACK);
g2d.drawOval(_startPosX + (15 * (i + 1)), _startPosY - 15, 15, 15);
}
}
}