Pibd-22_Presnyakova.V.V_Cat.../DrawningOars.java
2022-12-05 02:29:28 +04:00

38 lines
1.0 KiB
Java

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