import javax.swing.*; import java.awt.*; public class DrawningOars extends JComponent { private OarsCount _Oars; public void SetOarsCount(int numOfOars) { _Oars = OarsCount.GetOarsCount(numOfOars); } public void DrawOars(Graphics g, int _startPosX, int _startPosY) { super.paintComponent(g); 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.fillOval(_startPosX + 105 - 3 * i, _startPosY + 35, 3, 3); g2d.setColor(Color.BLACK); //g2d.drawOval(_startPosX + 105 - 3 * i, _startPosY + 35, 3, 3); g2d.drawRect(_startPosX + (10 * (i + 1)), _startPosY - 15, 5, 15); } } }