66 lines
2.2 KiB
Java
66 lines
2.2 KiB
Java
import java.awt.Color;
|
|
import java.awt.Graphics2D;
|
|
import java.awt.geom.Ellipse2D;
|
|
|
|
public class DrawingRollers {
|
|
Graphics2D g2d;
|
|
int startPosX;
|
|
int startPosY;
|
|
Color color;
|
|
private NumbeRollers _numbeRollers;
|
|
|
|
public void setNumRollers(int numRollers) {
|
|
if (numRollers < 4 || numRollers > 6 ){
|
|
|
|
_numbeRollers = NumbeRollers.fromNumberToEnum(numRollers);
|
|
return;
|
|
}
|
|
_numbeRollers = NumbeRollers.fromNumberToEnum(numRollers);
|
|
}
|
|
|
|
public DrawingRollers(Graphics2D g2d, int startPosX, int startPosY, Color color, int numRollers){
|
|
this.color = color;
|
|
this.g2d = g2d;
|
|
this.startPosX = startPosX;
|
|
this.startPosY = startPosY;
|
|
setNumRollers(numRollers);
|
|
}
|
|
|
|
public void Draw(){
|
|
g2d.setPaint(Color.BLACK);
|
|
Ellipse2D ellipse7 = new Ellipse2D.Double(startPosX + 10, startPosY + 55, 120, 20);
|
|
|
|
Ellipse2D ellipse1 = new Ellipse2D.Double(startPosX + 5, startPosY + 50, 20, 20);
|
|
Ellipse2D ellipse2 = new Ellipse2D.Double(startPosX + 30, startPosY + 50, 20, 20);
|
|
Ellipse2D ellipse3 = new Ellipse2D.Double(startPosX + 55, startPosY + 50, 20, 20);
|
|
Ellipse2D ellipse4 = new Ellipse2D.Double(startPosX + 80, startPosY + 50, 20, 20);
|
|
Ellipse2D ellipse5 = new Ellipse2D.Double(startPosX + 105, startPosY + 50, 20, 20);
|
|
Ellipse2D ellipse6 = new Ellipse2D.Double(startPosX + 125, startPosY + 60, 10, 10);
|
|
g2d.setPaint(color);
|
|
g2d.draw(ellipse7);
|
|
switch (_numbeRollers) {
|
|
case Min:
|
|
g2d.fill(ellipse1);
|
|
g2d.fill(ellipse2);
|
|
g2d.fill(ellipse3);
|
|
g2d.fill(ellipse4);
|
|
break;
|
|
case Mid:
|
|
g2d.fill(ellipse1);
|
|
g2d.fill(ellipse2);
|
|
g2d.fill(ellipse3);
|
|
g2d.fill(ellipse4);
|
|
g2d.fill(ellipse5);
|
|
break;
|
|
case Max:
|
|
g2d.fill(ellipse1);
|
|
g2d.fill(ellipse2);
|
|
g2d.fill(ellipse3);
|
|
g2d.fill(ellipse4);
|
|
g2d.fill(ellipse5);
|
|
g2d.fill(ellipse6);
|
|
break;
|
|
}
|
|
}
|
|
}
|