Mochalov D.V. Hard LabWork02 #2
@ -110,7 +110,7 @@ class DrawningLocomotive {
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawRect( (int)_startPosX + 50, (int)_startPosY + 10, 10, 20);
|
||||
//колеса
|
||||
extraWheelsDraw.DrawWheels((int)_startPosX, (int)_startPosY, g);
|
||||
extraWheelsDraw.DrawExtra((int)_startPosX, (int)_startPosY, g);
|
||||
//движок
|
||||
g.setColor(Locomotive.getBodyColor());
|
||||
g.fillRect((int)_startPosX + 100, (int)_startPosY + 10, 10, 30);
|
||||
|
@ -23,7 +23,7 @@ public class DrawningWarmlyLocomotive extends DrawningLocomotive{
|
||||
|
||||
if (warmlyLocomotive.FuelStorage)
|
||||
{
|
||||
g.fillRect((int)_startPosX + 110, (int)_startPosY + 10, 10, 50);
|
||||
g.fillRect((int)_startPosX + 120, (int)_startPosY + 10, 10, 50);
|
||||
g.fillRect((int)_startPosX + 110, (int)_startPosY + 40, 20, 20);
|
||||
g.fillRect((int)_startPosX + 110, (int)_startPosY, 30, 10);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import java.awt.*;
|
||||
|
||||
public class ExtraWheelsDraw {
|
||||
public class ExtraWheelsDraw implements IDrawningExtra{
|
||||
private WheelsCount wheelsCount = WheelsCount.Two;
|
||||
public void setWheelsNum(int num) {
|
||||
public void setExtraNum(int num) {
|
||||
switch (num) {
|
||||
case 0: {
|
||||
wheelsCount = WheelsCount.Three;
|
||||
@ -19,11 +19,11 @@ public class ExtraWheelsDraw {
|
||||
private Color color;
|
||||
|
||||
public ExtraWheelsDraw(int num, Color color) {
|
||||
setWheelsNum(num);
|
||||
setExtraNum(num);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void DrawWheels(int startPosX, int startPosY, Graphics2D g) {
|
||||
public void DrawExtra(int startPosX, int startPosY, Graphics2D g) {
|
||||
g.setColor(color);
|
||||
g.drawOval(startPosX, startPosY + 40, 10, 10);
|
||||
g.drawOval(startPosX + 90, startPosY + 40, 10, 10);
|
||||
|
6
IDrawningExtra.java
Normal file
6
IDrawningExtra.java
Normal file
@ -0,0 +1,6 @@
|
||||
import java.awt.*;
|
||||
|
||||
public interface IDrawningExtra {
|
||||
void setExtraNum(int num);
|
||||
void DrawExtra(int startPosX, int startPosY, Graphics2D g);
|
||||
}
|
Loading…
Reference in New Issue
Block a user