PIbd-21_Markov_D.P._Contain.../DrawingOvalDeck.java
2022-12-02 00:26:12 +04:00

40 lines
1.2 KiB
Java

import javax.swing.*;
import java.awt.*;
public class DrawingOvalDeck extends JComponent implements IAdditionalDrawingObject{
private AdditionalEnum _decksEnum;
@Override
public void SetAddEnum(int decksAmount) {
_decksEnum = AdditionalEnum.FromInteger(decksAmount);
}
@Override
public void DrawDeck(Color colorDeck, Graphics g, float _startPosX, float _startPosY)
{
if (_decksEnum == null)
{
return;
}
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
int numOfDecks = 0;
switch (_decksEnum)
{
case One:
numOfDecks = 1;
break;
case Two:
numOfDecks = 2;
break;
case Three:
numOfDecks = 3;
break;
}
for(int i = 0; i < numOfDecks; ++i){
g2d.setPaint(colorDeck);
g2d.fillOval((int)_startPosX+30 + 5*i, (int)_startPosY+25 - 5*i, 30*2 - 5*i, 5);
g2d.setPaint(Color.BLACK);
g2d.drawOval((int)_startPosX+30 + 5*i, (int)_startPosY+25 - 5*i, 30*2 - 5*i, 5);
}
}
}