diff --git a/.idea/misc.xml b/.idea/misc.xml index 0f8e7ab..e5d6295 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,6 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + + - - 1666633764627 + + 1666588645694 diff --git a/pom.xml b/pom.xml index 45825bc..ee13d2b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.zyzf + com.example PIbd-22_Kalyshev_Y_V_MotorBoat_Hard 1.0-SNAPSHOT PIbd-22_Kalyshev_Y_V_MotorBoat_Hard @@ -76,7 +76,7 @@ default-cli - com.zyzf.pibd22_kalyshev_y_v_motorboat_hard/com.zyzf.pibd22_kalyshev_y_v_motorboat_hard.HelloApplication + com.example.pibd22_kalyshev_y_v_motorboat_hard/com.example.pibd22_kalyshev_y_v_motorboat_hard.HelloApplication app app diff --git a/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/Direction.java b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/Direction.java new file mode 100644 index 0000000..13232de --- /dev/null +++ b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/Direction.java @@ -0,0 +1,26 @@ +package com.example.pibd22_kalyshev_y_v_motorboat_hard; + +public enum Direction { + Up, + Down, + Left, + Right; + + public static Direction FromInteger(int intValue) + { + switch(intValue) + { + case 1: + return Up; + case 2: + return Down; + case 3: + return Left; + case 4: + return Right; + default: + System.out.println("Error: incorrect value for enum"); + return Up; + } + } +} diff --git a/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/DrawningBoat.java b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/DrawningBoat.java new file mode 100644 index 0000000..383ed8e --- /dev/null +++ b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/DrawningBoat.java @@ -0,0 +1,132 @@ +package com.example.pibd22_kalyshev_y_v_motorboat_hard; + +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.paint.Color; + +public class DrawningBoat +{ + private EntityBoat _boat; + private DrawningOars _drawningOars; + private float _startPosX; + private float _startPosY; + private Integer _pictureWidth; + private Integer _pictureHeight; + private int _boatWidth = 170; + private int _boatHeight = 60; + + public EntityBoat GetBoat() + { + return _boat; + } + public DrawningOars GetDrawningOars() + { + return _drawningOars; + } + + public void Init(int speed, float weight, Color bodyColor) + { + _boat = new EntityBoat(); + _boat.Init(speed, weight, bodyColor); + + _drawningOars = new DrawningOars(); + _drawningOars.Init(bodyColor); + } + + public void SetPosition(int x, int y, int width, int height) + { + if (x < 0 || y < 0) { + return; + } + + if (x + _boatWidth > width || y + _boatHeight > height) { + return; + } + + _startPosX = x; + _startPosY = y; + + _pictureWidth = width; + _pictureHeight = height; + } + + public void MoveTransport(Direction direction) + { + if (_pictureWidth == null || _pictureHeight == null) { + return; + } + + switch (direction) { + case Up: + if (_startPosY - _boat.GetStep() > 0) { + _startPosY -= _boat.GetStep(); + } + break; + + case Down: + if (_startPosY + _boatHeight + _boat.GetStep() + _drawningOars.deltaYdown < _pictureHeight) { + _startPosY += _boat.GetStep(); + } + break; + + case Left: + if (_startPosX - _boat.GetStep() > 0) { + _startPosX -= _boat.GetStep(); + } + break; + + case Right: + if (_startPosX + _boatWidth + _boat.GetStep() < _pictureWidth) { + _startPosX += _boat.GetStep(); + } + break; + + default: + break; + } + } + + public void DrawTransport(GraphicsContext gc) + { + if (_startPosX < 0 || _startPosY < 0 || _pictureWidth == null || _pictureHeight == null) { + return; + } + + _startPosY += 40; + // Корпус + gc.setStroke(Color.BLACK); + gc.setLineWidth(2); + gc.setFill(_boat.GetBodyColor()); + gc.fillPolygon(new double[] {_startPosX, _startPosX+120, _startPosX+170, _startPosX+120, _startPosX, _startPosX}, + new double[] {_startPosY, _startPosY, _startPosY+30, _startPosY+60, _startPosY+60, _startPosY}, 6); + gc.strokePolyline(new double[] {_startPosX, _startPosX+120, _startPosX+170, _startPosX+120, _startPosX, _startPosX}, + new double[] {_startPosY, _startPosY, _startPosY+30, _startPosY+60, _startPosY+60, _startPosY}, 6); + + // Седло + gc.setFill(Color.BROWN); + gc.fillOval(_startPosX+10, _startPosY+10, 110, 40); + _startPosY -= 40; + _drawningOars.DrawOars(gc, _startPosX, _startPosY); + + } + + public void ChangeBorders(int width, int height) + { + _pictureWidth = width; + _pictureHeight = height; + + if (_pictureWidth <= _boatWidth || _pictureHeight <= _boatHeight) { + _pictureWidth = null; + _pictureHeight = null; + return; + } + + if (_startPosX + _boatWidth > _pictureWidth) { + _startPosX = _pictureWidth - _boatWidth; + } + + if (_startPosY + _boatHeight > _pictureHeight) { + _startPosY = _pictureHeight - _boatHeight; + } + } + +} diff --git a/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/DrawningOars.java b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/DrawningOars.java new file mode 100644 index 0000000..9fe6943 --- /dev/null +++ b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/DrawningOars.java @@ -0,0 +1,73 @@ +package com.example.pibd22_kalyshev_y_v_motorboat_hard; + +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.paint.Color; + +public class DrawningOars { + private Color _OarsColor; + private NumberOars _numOars; + public void SetNumberOars(int numberOars) + { + _numOars = NumberOars.FromInteger(numberOars); + } + public int deltaYdown = 0; + public void Init(Color oarsColor) + { + _OarsColor = oarsColor; + } + + public void DrawOars(GraphicsContext gc, float startPosX, float startPosY) { + if (_OarsColor == null) { + return; + } + + gc.setFill(_OarsColor); + + switch (_numOars) { + case One: + DrawOar1(gc, startPosX, startPosY); + deltaYdown = 40; + break; + + case Two: + DrawOar1(gc, startPosX, startPosY); + DrawOar2(gc, startPosX, startPosY); + deltaYdown = 80; + break; + + case Three: + DrawOar1(gc, startPosX, startPosY); + DrawOar2(gc, startPosX, startPosY); + DrawOar3(gc, startPosX, startPosY); + deltaYdown = 80; + break; + } + } + void DrawOar1(GraphicsContext gc, float startPosX, float startPosY) { + gc.setFill(_OarsColor); + gc.setStroke(Color.BLACK); + gc.setLineWidth(2); + gc.strokePolyline(new double[]{startPosX + 60, startPosX + 80, startPosX + 80, startPosX + 90, startPosX + 100, startPosX + 90, startPosX + 70, startPosX + 60}, + new double[]{startPosY + 60, startPosY + 20, startPosY + 10, startPosY, startPosY + 10, startPosY + 20, startPosY + 60, startPosY + 60}, 8); + gc.fillPolygon(new double[]{startPosX + 60, startPosX + 80, startPosX + 80, startPosX + 90, startPosX + 100, startPosX + 90, startPosX + 70, startPosX + 60}, + new double[]{startPosY + 60, startPosY + 20, startPosY + 10, startPosY, startPosY + 10, startPosY + 20, startPosY + 60, startPosY + 60}, 8); + } + void DrawOar2(GraphicsContext gc, float startPosX, float startPosY) { + gc.setFill(_OarsColor); + gc.setStroke(Color.BLACK); + gc.setLineWidth(2); + gc.strokePolyline(new double[]{startPosX+50, startPosX+30, startPosX+20, startPosX+30, startPosX+40, startPosX+40, startPosX+60, startPosX+50}, + new double[]{startPosY+80, startPosY+120, startPosY+130, startPosY+140, startPosY+130, startPosY+120, startPosY+80, startPosY+80}, 8); + gc.fillPolygon(new double[]{startPosX+50, startPosX+30, startPosX+20, startPosX+30, startPosX+40, startPosX+40, startPosX+60, startPosX+50}, + new double[]{startPosY+80, startPosY+120, startPosY+130, startPosY+140, startPosY+130, startPosY+120, startPosY+80, startPosY+80}, 8); + } + void DrawOar3(GraphicsContext gc, float startPosX, float startPosY) { + gc.setFill(_OarsColor); + gc.setStroke(Color.BLACK); + gc.setLineWidth(2); + gc.strokePolyline(new double[]{startPosX+90, startPosX+100, startPosX+100, startPosX+100, startPosX+110, startPosX+100, startPosX+90, startPosX+90}, + new double[]{startPosY+90, startPosY+90, startPosY+30, startPosY+40, startPosY+30, startPosY+20, startPosY+30, startPosY+90}, 8); + gc.fillPolygon(new double[]{startPosX+90, startPosX+100, startPosX+100, startPosX+100, startPosX+110, startPosX+100, startPosX+90, startPosX+90}, + new double[]{startPosY+90, startPosY+90, startPosY+30, startPosY+40, startPosY+30, startPosY+20, startPosY+30, startPosY+90}, 8); + } +} diff --git a/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/EntityBoat.java b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/EntityBoat.java new file mode 100644 index 0000000..cf44613 --- /dev/null +++ b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/EntityBoat.java @@ -0,0 +1,38 @@ +package com.example.pibd22_kalyshev_y_v_motorboat_hard; + +import javafx.scene.paint.Color; +import java.util.Random; + +public class EntityBoat +{ + private int _speed; + private float _weight; + private Color _bodyColor; + public int GetSpeed() + { + return _speed; + } + + public float GetWeight() + { + return _weight; + } + + public Color GetBodyColor() + { + return _bodyColor; + } + + public float GetStep() + { + return _speed * 100 / _weight; + } + + public void Init(int speed, float weight, Color bodyColor) + { + Random random = new Random(); + _speed = speed <= 0 ? random.nextInt(5) + 25 : speed; + _weight = weight <= 0 ? random.nextInt(30) + 70 : weight; + _bodyColor = bodyColor; + } +} diff --git a/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/FormBoat.java b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/FormBoat.java new file mode 100644 index 0000000..7dc01b4 --- /dev/null +++ b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/FormBoat.java @@ -0,0 +1,305 @@ +package com.example.pibd22_kalyshev_y_v_motorboat_hard; + +import javafx.application.Application; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.canvas.Canvas; +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.control.Button; +import javafx.scene.control.ComboBox; +import javafx.scene.control.Label; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.paint.Color; +import javafx.stage.Stage; + +import java.io.IOException; +import java.util.Random; + +public class FormBoat extends Application +{ + private Pane _root; + private Scene _scene; + private Canvas _canvas; + private HBox _hBox; + private Button _buttonCreate; + private Button _buttonUp; + private Button _buttonDown; + private Button _buttonLeft; + private Button _buttonRight; + private Label _labelSpeedValue; + private Label _labelWeightValue; + private Label _labelBodyColorValue; + private ComboBox _comboBoxNumOars; + private double _hBoxHeight; + private double _buttonCreateHeight; + private final int _buttonMoveWidth = 30; + private final int _buttonMoveHeight = 30; + private final int _distanceBetweenMoveButtons = 5; + private final double _buttonMargin = 10.0; + private DrawningBoat _boat; + + @Override + public void start(Stage stage) throws IOException + { + FXMLLoader fxmlLoader = new FXMLLoader(FormBoat.class.getResource("hello-view.fxml")); + _scene = new Scene(fxmlLoader.load(), 600, 400); + + _root = (Pane) _scene.lookup("#root"); + _root.setStyle("-fx-background-color: #31374c;"); + + _canvas = new Canvas(); + _root.getChildren().add(_canvas); + + InitHBox(); + InitButtonCreate(); + InitMoveButtons(); + + stage.setTitle("Boat"); + stage.setScene(_scene); + + _scene.widthProperty().addListener((obs, oldVal, newVal) -> { + UpdateGUI(); + if (_boat != null) + { + _boat.ChangeBorders((int) _canvas.getWidth(), (int) _canvas.getHeight()); + } + Draw(); + }); + + _scene.heightProperty().addListener((obs, oldVal, newVal) -> { + UpdateGUI(); + if (_boat != null) + { + _boat.ChangeBorders((int) _canvas.getWidth(), (int) _canvas.getHeight()); + } + Draw(); + }); + + _root.applyCss(); + _root.layout(); + + stage.setOnShowing(event -> { + _hBoxHeight = _hBox.getHeight(); + _buttonCreateHeight = _buttonCreate.getHeight(); + UpdateGUI(); + Draw(); + }); + + stage.show(); + } + + private void InitHBox() + { + _hBox = new HBox(); + _hBox.setStyle("-fx-background-color: #31374c;"); + _root.getChildren().add(_hBox); + + Label labelSpeed = new Label("Speed:"); + labelSpeed.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;"); + _hBox.getChildren().add(labelSpeed); + + _labelSpeedValue = new Label("-"); + _labelSpeedValue.setStyle("-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;"); + _hBox.getChildren().add(_labelSpeedValue); + + Label labelWeight = new Label("Weight:"); + labelWeight.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;"); + _hBox.getChildren().add(labelWeight); + + _labelWeightValue = new Label("-"); + _labelWeightValue.setStyle("-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;"); + _hBox.getChildren().add(_labelWeightValue); + + Label labelHullColor = new Label("Color:"); + labelHullColor.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;"); + _hBox.getChildren().add(labelHullColor); + + _labelBodyColorValue = new Label("-"); + _labelBodyColorValue.setStyle("-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;"); + _hBox.getChildren().add(_labelBodyColorValue); + + Label labelNumOars = new Label("Oars:"); + labelNumOars.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;"); + _hBox.getChildren().add(labelNumOars); + + ObservableList optionsForNumOars = FXCollections.observableArrayList("1", "2", "3"); + _comboBoxNumOars = new ComboBox<>(optionsForNumOars); + _comboBoxNumOars.setValue("1"); + + _comboBoxNumOars.setOnAction(e -> { + if (_boat != null) { + _boat.GetDrawningOars().SetNumberOars(Integer.parseInt(_comboBoxNumOars.getValue())); + Draw(); + } + }); + + _hBox.getChildren().add(_comboBoxNumOars); + } + private void InitButtonCreate() + { + _buttonCreate = new Button("Create"); + _buttonCreate.setTranslateX(_buttonMargin); + _root.getChildren().add(_buttonCreate); + + _buttonCreate.setOnAction(e -> { + Random rnd = new Random(); + + _boat = new DrawningBoat(); + _boat.Init(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000, + Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256))); + _boat.SetPosition(rnd.nextInt(90) + 10, rnd.nextInt(90)+50, + (int) _canvas.getWidth(), (int) _canvas.getHeight()); + + _boat.GetDrawningOars().SetNumberOars(Integer.parseInt(_comboBoxNumOars.getValue())); + + _labelSpeedValue.setText(Integer.toString(_boat.GetBoat().GetSpeed())); + _labelWeightValue.setText(Double.toString(_boat.GetBoat().GetWeight())); + _labelBodyColorValue.setText(_boat.GetBoat().GetBodyColor().toString()); + + Draw(); + }); + } + private void InitMoveButtons() + { + Image img; + ImageView view; + + // Button "Up" + _buttonUp = new Button(); + + img = new Image("arrowUp.png"); + view = new ImageView(img); + view.setFitHeight(14); + view.setFitWidth(14); + _buttonUp.setGraphic(view); + + _buttonUp.setPrefWidth(_buttonMoveWidth); + _buttonUp.setPrefHeight(_buttonMoveHeight); + + _buttonUp.setOnAction(e -> { + if (_boat != null) { + _boat.MoveTransport(Direction.Up); + Draw(); + } + }); + + _root.getChildren().add(_buttonUp); + + // Button "Down" + _buttonDown = new Button(); + + img = new Image("arrowDown.png"); + view = new ImageView(img); + view.setFitHeight(14); + view.setFitWidth(14); + _buttonDown.setGraphic(view); + + _buttonDown.setPrefWidth(_buttonMoveWidth); + _buttonDown.setPrefHeight(_buttonMoveHeight); + + _buttonDown.setOnAction(e -> { + if (_boat != null) { + _boat.MoveTransport(Direction.Down); + Draw(); + } + }); + + _root.getChildren().add(_buttonDown); + + // Button "Left" + _buttonLeft = new Button(); + + img = new Image("arrowLeft.png"); + view = new ImageView(img); + view.setFitHeight(14); + view.setFitWidth(14); + _buttonLeft.setGraphic(view); + + _buttonLeft.setPrefWidth(_buttonMoveWidth); + _buttonLeft.setPrefHeight(_buttonMoveHeight); + + _buttonLeft.setOnAction(e -> { + if (_boat != null) { + _boat.MoveTransport(Direction.Left); + Draw(); + } + }); + + _root.getChildren().add(_buttonLeft); + + // Button "Right" + _buttonRight = new Button(); + + img = new Image("arrowRight.png"); + view = new ImageView(img); + view.setFitHeight(14); + view.setFitWidth(14); + _buttonRight.setGraphic(view); + + _buttonRight.setPrefWidth(_buttonMoveWidth); + _buttonRight.setPrefHeight(_buttonMoveHeight); + + _buttonRight.setOnAction(e -> { + if (_boat != null) { + _boat.MoveTransport(Direction.Right); + Draw(); + } + }); + + _root.getChildren().add(_buttonRight); + } + private void UpdateGUI() + { + double sceneWidth = _scene.getWidth(); + double sceneHeight = _scene.getHeight(); + + _canvas.setWidth(sceneWidth); + _hBox.setPrefWidth(sceneWidth); + _canvas.setHeight(sceneHeight - _hBoxHeight); + _hBox.setTranslateY(sceneHeight - _hBoxHeight); + + _buttonCreate.setTranslateY(sceneHeight - _hBoxHeight - _buttonCreateHeight - _buttonMargin); + + _buttonUp.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight * 2.0 - _buttonMargin - + _distanceBetweenMoveButtons); + _buttonUp.setTranslateX(sceneWidth - _buttonMargin - _buttonMoveWidth * 2.0 - _distanceBetweenMoveButtons); + + _buttonDown.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight - _buttonMargin); + _buttonDown.setTranslateX(sceneWidth- _buttonMargin - _buttonMoveWidth * 2.0 - _distanceBetweenMoveButtons); + + _buttonLeft.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight - _buttonMargin); + _buttonLeft.setTranslateX(sceneWidth - _buttonMargin - _buttonMoveWidth * 3.0 - + _distanceBetweenMoveButtons * 2.0); + + _buttonRight.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight - _buttonMargin); + _buttonRight.setTranslateX(sceneWidth - _buttonMargin - _buttonMoveWidth); + } + + private void Draw() + { + GraphicsContext gc = _canvas.getGraphicsContext2D(); + + gc.clearRect(0.0, 0.0, _canvas.getWidth(), _canvas.getHeight()); + gc.setFill(Color.WHITE); + gc.fillRect(0.0, 0.0, _canvas.getWidth(), _canvas.getHeight()); + + gc.setStroke(Color.BLACK); + gc.setLineWidth(4); + gc.strokeRect(0.0, 0.0, _canvas.getWidth(), _canvas.getHeight()); + + if (_boat != null) + { + _boat.DrawTransport(gc); + } + } + + public static void main(String[] args) + { + launch(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/NumberOars.java b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/NumberOars.java new file mode 100644 index 0000000..26cb2f4 --- /dev/null +++ b/src/main/java/com/example/pibd22_kalyshev_y_v_motorboat_hard/NumberOars.java @@ -0,0 +1,27 @@ +package com.example.pibd22_kalyshev_y_v_motorboat_hard; + +public enum NumberOars +{ + One, + Two, + Three; + + public static NumberOars FromInteger(int intValue) + { + switch(intValue) + { + case 1: + return One; + + case 2: + return Two; + + case 3: + return Three; + + default: + System.out.println("Error: incorrect value for enum"); + return One; + } + } +} diff --git a/src/main/java/com/zyzf/pibd22_kalyshev_y_v_motorboat_hard/HelloApplication.java b/src/main/java/com/zyzf/pibd22_kalyshev_y_v_motorboat_hard/HelloApplication.java deleted file mode 100644 index af1e1b2..0000000 --- a/src/main/java/com/zyzf/pibd22_kalyshev_y_v_motorboat_hard/HelloApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.zyzf.pibd22_kalyshev_y_v_motorboat_hard; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Scene; -import javafx.stage.Stage; - -import java.io.IOException; - -public class HelloApplication extends Application { - @Override - public void start(Stage stage) throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 320, 240); - stage.setTitle("Hello!"); - stage.setScene(scene); - stage.show(); - } - - public static void main(String[] args) { - launch(); - } -} \ No newline at end of file diff --git a/src/main/java/com/zyzf/pibd22_kalyshev_y_v_motorboat_hard/HelloController.java b/src/main/java/com/zyzf/pibd22_kalyshev_y_v_motorboat_hard/HelloController.java deleted file mode 100644 index d2ff791..0000000 --- a/src/main/java/com/zyzf/pibd22_kalyshev_y_v_motorboat_hard/HelloController.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.zyzf.pibd22_kalyshev_y_v_motorboat_hard; - -import javafx.fxml.FXML; -import javafx.scene.control.Label; - -public class HelloController { - @FXML - private Label welcomeText; - - @FXML - protected void onHelloButtonClick() { - welcomeText.setText("Welcome to JavaFX Application!"); - } -} \ No newline at end of file diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 09f79b8..c2b9610 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,10 +1,10 @@ -module com.zyzf.pibd22_kalyshev_y_v_motorboat_hard { +module com.example.pibd22_kalyshev_y_v_motorboat_hard { requires javafx.controls; requires javafx.fxml; requires org.controlsfx.controls; requires com.dlsc.formsfx; - opens com.zyzf.pibd22_kalyshev_y_v_motorboat_hard to javafx.fxml; - exports com.zyzf.pibd22_kalyshev_y_v_motorboat_hard; + opens com.example.pibd22_kalyshev_y_v_motorboat_hard to javafx.fxml; + exports com.example.pibd22_kalyshev_y_v_motorboat_hard; } \ No newline at end of file diff --git a/src/main/resources/arrowDown.png b/src/main/resources/arrowDown.png new file mode 100644 index 0000000..f4e08ba Binary files /dev/null and b/src/main/resources/arrowDown.png differ diff --git a/src/main/resources/arrowLeft.png b/src/main/resources/arrowLeft.png new file mode 100644 index 0000000..ded8e03 Binary files /dev/null and b/src/main/resources/arrowLeft.png differ diff --git a/src/main/resources/arrowRight.png b/src/main/resources/arrowRight.png new file mode 100644 index 0000000..3df5932 Binary files /dev/null and b/src/main/resources/arrowRight.png differ diff --git a/src/main/resources/arrowUp.png b/src/main/resources/arrowUp.png new file mode 100644 index 0000000..46ff64c Binary files /dev/null and b/src/main/resources/arrowUp.png differ diff --git a/src/main/resources/com/example/pibd22_kalyshev_y_v_motorboat_hard/hello-view.fxml b/src/main/resources/com/example/pibd22_kalyshev_y_v_motorboat_hard/hello-view.fxml new file mode 100644 index 0000000..d974059 --- /dev/null +++ b/src/main/resources/com/example/pibd22_kalyshev_y_v_motorboat_hard/hello-view.fxml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file