Choose style by Drag&Drop

This commit is contained in:
shadowik 2022-11-29 03:49:33 +04:00
parent 691a60e11d
commit 112a806373
3 changed files with 15 additions and 5 deletions

View File

@ -47,9 +47,6 @@ public class ControllerBusConfig {
_bus.DrawTransport(gc);
}
@FXML
private Button buttonCancel;
@FXML
private Canvas canvasObject;
@ -104,9 +101,13 @@ public class ControllerBusConfig {
case "labelModifiedObject" -> _bus = new DrawingDDB(spinnerSpeed.getValue(),
spinnerWeight.getValue(), Color.WHITE, spinnerDoors.getValue(), Color.BLACK,
checkBoxSecondStage.isSelected(), checkBoxLadder.isSelected());
case "labelTriangle" -> _bus.ChangeDoor(new DrawingTriangleDoors());
case "labelOval" -> _bus.ChangeDoor(new DrawingEllipsoidDoors());
case "labelRect" -> _bus.ChangeDoor(new DrawingDoors());
}
event.consume();
DrawBus();
event.consume();
}
@FXML

View File

@ -12,7 +12,7 @@ public class DrawingBus {
int _speed;
float _weight;
Color _bodyColor;
int _countOfDoors;
int _countOfDoors = 3;
private static final int _null = -1000;
protected float _startPosX;
@ -42,6 +42,12 @@ public class DrawingBus {
}
public void ChangeDoor(IDrawingDoors door) {
Doors = door;
Doors.setCountOfDoors(_countOfDoors);
}
public DrawingBus(int speed, float weight, Color bodyColor) {
Bus = new EntityBus(speed, weight, bodyColor);
}

View File

@ -54,6 +54,9 @@
<SpinnerValueFactory.IntegerSpinnerValueFactory initialValue="1" max="5" min="3" />
</valueFactory>
</Spinner>
<Label fx:id="labelTriangle" alignment="CENTER" layoutX="14.0" layoutY="331.0" onDragDetected="#LabelObject_OnDragDetected" prefHeight="30" prefWidth="97.0" style="-fx-border-color: black;" text="Треугольник" textOverrun="CLIP" />
<Label fx:id="labelOval" alignment="CENTER" layoutX="128.0" layoutY="331.0" onDragDetected="#LabelObject_OnDragDetected" prefHeight="30" prefWidth="52.0" style="-fx-border-color: black;" text="Овал" textOverrun="CLIP" />
<Label fx:id="labelRect" alignment="CENTER" layoutX="199.0" layoutY="331.0" onDragDetected="#LabelObject_OnDragDetected" prefHeight="30" prefWidth="90.0" style="-fx-border-color: black;" text="Квадрат" textOverrun="CLIP" />
</Pane>
<Label alignment="CENTER" layoutX="356.0" layoutY="52.0" onDragDropped="#LabelBaseColor_OnDragDropped" onDragOver="#LabelColor_OnDragOver" prefHeight="30" prefWidth="127.0" style="-fx-border-color: black;" text="Цвет">
Color