44 lines
1.8 KiB
Java
44 lines
1.8 KiB
Java
import java.awt.*;
|
|
|
|
public class DrawingRoundRectangleBlocks implements IDrawingObjectBlock {
|
|
private BlockCount _block;
|
|
public DrawingRoundRectangleBlocks(BlockCount block) {
|
|
_block=block;
|
|
}
|
|
@Override
|
|
public void SetBlockCount(int count){
|
|
for (BlockCount temp: BlockCount.values())
|
|
if (temp.GetBlockCount() == count){
|
|
_block=temp;
|
|
return;
|
|
}
|
|
}
|
|
@Override
|
|
public void DrawBlocks(Graphics2D g2, int _startPosX, int _startPosY){
|
|
if (_block.GetBlockCount() >= 2) {
|
|
g2.setColor(Color.GRAY);
|
|
g2.fillRoundRect(_startPosX + 15, _startPosY + 10, 10, 10, 7, 7);
|
|
g2.fillRoundRect(_startPosX + 15, _startPosY + 20, 10, 10, 7, 7);
|
|
g2.setColor(Color.BLACK);
|
|
g2.drawRoundRect(_startPosX + 15, _startPosY + 10, 10, 10, 7, 7);
|
|
g2.drawRoundRect(_startPosX + 15, _startPosY + 20, 10, 10, 7, 7);
|
|
}
|
|
if (_block.GetBlockCount() >= 4) {
|
|
g2.setColor(Color.GRAY);
|
|
g2.fillRoundRect(_startPosX + 25, _startPosY + 10, 10, 10, 7, 7);
|
|
g2.fillRoundRect(_startPosX + 25, _startPosY + 20, 10, 10, 7, 7);
|
|
g2.setColor(Color.BLACK);
|
|
g2.drawRoundRect(_startPosX + 25, _startPosY + 10, 10, 10, 7, 7);
|
|
g2.drawRoundRect(_startPosX + 25, _startPosY + 20, 10, 10, 7, 7);
|
|
}
|
|
if (_block.GetBlockCount() >= 6) {
|
|
g2.setColor(Color.GRAY);
|
|
g2.fillRoundRect(_startPosX + 35, _startPosY + 10, 10, 10, 7, 7);
|
|
g2.fillRoundRect(_startPosX + 35, _startPosY + 20, 10, 10, 7, 7);
|
|
g2.setColor(Color.BLACK);
|
|
g2.drawRoundRect(_startPosX + 35, _startPosY + 10, 10, 10, 7, 7);
|
|
g2.drawRoundRect(_startPosX + 35, _startPosY + 20, 10, 10, 7, 7);
|
|
}
|
|
}
|
|
}
|