54 lines
1.3 KiB
Java
54 lines
1.3 KiB
Java
|
package DifferenceOfWheels;
|
||
|
|
||
|
import java.awt.*;
|
||
|
import java.util.Random;
|
||
|
|
||
|
public class DrawningWheels implements IOrnaments {
|
||
|
int CountWeel;
|
||
|
Random rnd = new Random();
|
||
|
int ranOrnament = rnd.nextInt(0, 3);
|
||
|
|
||
|
@Override
|
||
|
public void SetCount(int n) {
|
||
|
for (EnumWheels count: EnumWheels.values()) {
|
||
|
if (count.get_number() == n) {
|
||
|
CountWeel = n;
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@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);
|
||
|
|
||
|
}
|
||
|
|
||
|
@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;
|
||
|
}
|
||
|
}
|
||
|
}
|