58 lines
1.6 KiB
Java
58 lines
1.6 KiB
Java
|
package DifferenceOfWheels;
|
||
|
|
||
|
import java.awt.*;
|
||
|
|
||
|
public class DrawningOrnamentStar implements IOrnaments{
|
||
|
int CountWeel;
|
||
|
@Override
|
||
|
public void SetCount(int n) {
|
||
|
CountWeel = n;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int get_count_weels() {
|
||
|
return CountWeel;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void DrawOrnament(Graphics2D g, int x, int y) {
|
||
|
g.setColor(Color.BLACK);
|
||
|
g.fillOval(x, y, 25, 25);
|
||
|
|
||
|
g.setColor(Color.CYAN);
|
||
|
Polygon elements = new Polygon();
|
||
|
elements.addPoint(x + 12, y + 2);
|
||
|
elements.addPoint(x + 15, y + 8);
|
||
|
elements.addPoint(x + 21, y + 10);
|
||
|
elements.addPoint(x + 15, y + 13);
|
||
|
elements.addPoint(x + 19, y + 19);
|
||
|
elements.addPoint(x + 12, y + 15);
|
||
|
elements.addPoint(x + 5, y + 19);
|
||
|
elements.addPoint(x + 9, y + 13);
|
||
|
elements.addPoint(x + 3, y + 10);
|
||
|
elements.addPoint(x + 10, y + 8);
|
||
|
g.fillPolygon(elements);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void DrawWeels(Graphics2D g, int x, int y) {
|
||
|
switch (CountWeel){
|
||
|
case 2:
|
||
|
DrawOrnament(g, x + 10, y + 67);
|
||
|
DrawOrnament(g, x + 85, y + 67);
|
||
|
break;
|
||
|
case 3:
|
||
|
DrawOrnament(g, x + 10, y + 67);
|
||
|
DrawOrnament(g, x + 38, y + 67);
|
||
|
DrawOrnament(g, x + 85, y + 67);
|
||
|
break;
|
||
|
case 4:
|
||
|
DrawOrnament(g, x + 5, y + 67);
|
||
|
DrawOrnament(g, x + 32, y + 67);
|
||
|
DrawOrnament(g, x + 61, y + 67);
|
||
|
DrawOrnament(g, x + 88, y + 67);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|