функция для пункта 6 лабы 5
This commit is contained in:
parent
789fe7165d
commit
1a6dcf7059
@ -8,11 +8,6 @@ import java.awt.event.*;
|
||||
|
||||
public class DrawingLoco extends DrawingTrain{
|
||||
|
||||
public void setAdditionalColor(Color color)
|
||||
{
|
||||
((EntityLoco)EntityTrain).AdditionalColor = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
|
@ -9,11 +9,6 @@ import java.awt.event.*;
|
||||
public class DrawingTrain {
|
||||
public IMoveableObject GetMoveableObject() { return new DrawningObjectTrain(this);}
|
||||
|
||||
public void setBodyColor(Color color)
|
||||
{
|
||||
EntityTrain.BodyColor = color;
|
||||
}
|
||||
|
||||
protected IWheelDrawing wheelDrawing;
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
|
@ -8,6 +8,8 @@ import java.awt.event.*;
|
||||
|
||||
public class EntityLoco extends EntityTrain{
|
||||
public Color AdditionalColor;
|
||||
|
||||
public void setAdditionalColor(Color color){AdditionalColor = color;}
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия трубы
|
||||
/// </summary>
|
||||
|
@ -19,6 +19,8 @@ public class EntityTrain {
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor;
|
||||
|
||||
public void setBodyColor(Color color){BodyColor = color;}
|
||||
/// <summary>
|
||||
/// Шаг перемещения поезда
|
||||
/// </summary>
|
||||
|
@ -230,7 +230,7 @@ public class FormTrainConfig {
|
||||
Color color = (Color) support.getTransferable().getTransferData(ColorTransferable.colorDataFlavor);
|
||||
if (_train == null)
|
||||
return false;
|
||||
_train.setBodyColor(color);
|
||||
_train.EntityTrain.setBodyColor(color);
|
||||
canvas.repaint();
|
||||
return true;
|
||||
} catch (UnsupportedFlavorException | IOException e) {
|
||||
@ -262,7 +262,7 @@ public class FormTrainConfig {
|
||||
return false;
|
||||
if (!(_train instanceof DrawingLoco))
|
||||
return false;
|
||||
((DrawingLoco)_train).setAdditionalColor(color);
|
||||
((EntityLoco)_train.EntityTrain).setAdditionalColor(color);
|
||||
return true;
|
||||
} catch (UnsupportedFlavorException | IOException e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user