PIbd-23_Kharlamov_A.A._Stor.../DrawningOvalEngines.java

52 lines
1.6 KiB
Java
Raw Permalink Normal View History

import java.awt.*;
public class DrawningOvalEngines implements IDrawningEngines{
private DirectionEnginesOnStormtrooper enginesCount;
@Override
public void Draw(Graphics g, int x, int y, Color bodyColor) {
g.setColor(bodyColor);
switch (enginesCount) {
case TWO:
g.fillOval(x + 50, y, 20, 10);
g.fillOval(x + 50, y+90, 20, 10);
break;
case FOUR:
g.fillOval(x + 50, y, 20, 10);
g.fillOval(x + 50, y+15, 20, 10);
g.fillOval(x + 50, y+75, 20, 10);
g.fillOval(x + 50, y+90, 20, 10);
break;
case SIX:
g.fillOval(x + 50, y, 20, 10);
g.fillOval(x + 50, y+15, 20, 10);
g.fillOval(x + 50, y+30, 20, 10);
g.fillOval(x + 50, y+60, 20, 10);
g.fillOval(x + 50, y+75, 20, 10);
g.fillOval(x + 50, y+90, 20, 10);
break;
}
}
@Override
public void SetNewEngines(int count) {
switch(count)
{
case 2:
enginesCount = DirectionEnginesOnStormtrooper.TWO;
break;
case 4:
enginesCount = DirectionEnginesOnStormtrooper.FOUR;
break;
case 6:
enginesCount = DirectionEnginesOnStormtrooper.SIX;
break;
default:
break;
}
}
public DrawningOvalEngines(int count){
SetNewEngines(count);
}
}