42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
import javax.swing.*;
|
|
import java.awt.*;
|
|
public class DrawingTriangleDeck 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);
|
|
int[] xValues={(int)_startPosX+40 + 5*i,(int)_startPosX+40+15 + 5*i,(int)_startPosX+40+45,(int)_startPosX+40+60};
|
|
int[] yValues={(int)_startPosY+25 -5*i,(int)_startPosY+30 - 5*i,(int)_startPosY+30 - 5*i,(int)_startPosY+25 - 5*i};
|
|
g2d.fillPolygon(xValues,yValues,4);
|
|
g2d.setPaint(Color.BLACK);
|
|
g2d.drawPolygon(xValues,yValues,4);
|
|
}
|
|
}
|
|
}
|