Pibd-22_Presnyakova.V.V_Cat.../DrawningSqareOars.java

34 lines
972 B
Java
Raw Permalink Normal View History

2022-12-05 02:29:28 +04:00
import java.awt.*;
public class DrawningSqareOars 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);
2022-12-05 11:12:21 +04:00
int numOfOars = 0;
2022-12-05 02:29:28 +04:00
switch (_Oars)
{
case One:
2022-12-05 11:12:21 +04:00
numOfOars = 1;
2022-12-05 02:29:28 +04:00
break;
case Two:
2022-12-05 11:12:21 +04:00
numOfOars = 2;
2022-12-05 02:29:28 +04:00
break;
case Three:
2022-12-05 11:12:21 +04:00
numOfOars = 3;
2022-12-05 02:29:28 +04:00
break;
}
2022-12-05 11:12:21 +04:00
for(int i = numOfOars; i >= 1; --i){
2022-12-05 02:29:28 +04:00
g2d.setColor(Color.CYAN);
2022-12-05 11:12:21 +04:00
g2d.fillRect(_startPosX + (15 * (i + 1)), _startPosY -15, 15, 15);
2022-12-05 02:29:28 +04:00
g2d.setColor(Color.BLACK);
2022-12-05 11:12:21 +04:00
g2d.drawRect(_startPosX + (15 * (i + 1)), _startPosY - 15, 15, 15);
2022-12-05 02:29:28 +04:00
}
}
}