PIbd-14_Antonova_A.A.__Hard/DifferenceOfWheels/DrawningOrnamentTriangle.java

52 lines
1.3 KiB
Java
Raw Normal View History

2024-06-10 13:56:47 +04:00
package DifferenceOfWheels;
import java.awt.*;
public class DrawningOrnamentTriangle implements IOrnaments{
int CountWeel;
@Override
public void SetCount(int n) {
CountWeel = n;
}
@Override
public Integer 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.MAGENTA);
Polygon elements = new Polygon();
elements.addPoint(x + 7, y + 6);
elements.addPoint(x + 20, y + 6);
elements.addPoint(x + 7, y + 18);
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;
}
}
}