From 17a6c9b10f21202b2d6f9df6ee8fc2dc002da49f Mon Sep 17 00:00:00 2001 From: pp Date: Mon, 29 Nov 2021 14:57:09 +0100 Subject: [PATCH] =?UTF-8?q?L=C3=A9p=C3=A9ssz=C3=A1m=20kijelz=C3=A9se=20?= =?UTF-8?q?=C3=A9s=20men=C3=BCpontok=20be=C3=A1ll=C3=ADt=C3=A1sa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hanoi/FoablakController.java | 1 - src/hanoi/HanoiFormController.java | 60 ++++++++++++++++++++++++++++++ src/hanoi/hanoi_form2.fxml | 25 ++++++------- src/module-info.java | 1 + 4 files changed, 73 insertions(+), 14 deletions(-) diff --git a/src/hanoi/FoablakController.java b/src/hanoi/FoablakController.java index 5c3ad14..c3a2bf3 100644 --- a/src/hanoi/FoablakController.java +++ b/src/hanoi/FoablakController.java @@ -7,7 +7,6 @@ import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Node; -import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Spinner; diff --git a/src/hanoi/HanoiFormController.java b/src/hanoi/HanoiFormController.java index 10b4ce0..c182ff0 100644 --- a/src/hanoi/HanoiFormController.java +++ b/src/hanoi/HanoiFormController.java @@ -1,17 +1,41 @@ package hanoi; +import java.io.Closeable; import java.net.URL; +import java.util.Optional; import java.util.ResourceBundle; + +import javafx.application.Platform; +import javafx.event.ActionEvent; import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.ButtonType; +import javafx.scene.control.Label; +import javafx.scene.control.MenuItem; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; +import javafx.stage.Stage; public class HanoiFormController { private Korong kezbeKorong; + + @FXML + private MenuItem ujItem; + + @FXML + private MenuItem beallItem; + + @FXML + private MenuItem kilepItem; + + @FXML + private MenuItem helpItem; + @FXML private ResourceBundle resources; @@ -33,7 +57,41 @@ public class HanoiFormController { @FXML private Pane felvettPane; + + @FXML + private Label lepesCimke; + @FXML + void beallKattintas(ActionEvent event) { + + } + + @FXML + void helpKattintas(ActionEvent event) { + + } + + @FXML + void kilepkattintas(ActionEvent event) { + Alert alert = new Alert(AlertType.CONFIRMATION); + alert.setTitle("Kilépés megerősítése"); + alert.setHeaderText("Ön a kilépés menüpontra kattintott."); + alert.setContentText("Valóban ki akar lépni a programból?"); + + + Optional result = alert.showAndWait(); + if (result.get() == ButtonType.OK){ + // ... itt kell kilépni + //Platform.exit(); + ((Stage)jatekTerulet.getScene().getWindow()).close(); + } + } + + @FXML + void ujKattintas(ActionEvent event) { + + } + @FXML void elsoRudClick(MouseEvent event) { korongMozgatas(r1); @@ -62,6 +120,8 @@ public class HanoiFormController { if (r.addKorong(kezbeKorong)) { kezbeKorong = null; egyRudRajzolas(r); + fh.lepesNoveles(); + lepesCimke.setText("Lépések száma: "+fh.getLepesSzam()); } } //rudRajzolas(); diff --git a/src/hanoi/hanoi_form2.fxml b/src/hanoi/hanoi_form2.fxml index a2ef735..6d09567 100644 --- a/src/hanoi/hanoi_form2.fxml +++ b/src/hanoi/hanoi_form2.fxml @@ -41,6 +41,7 @@ + @@ -48,23 +49,16 @@ - - - + - - - - + - - - + - + @@ -75,9 +69,14 @@ - + - diff --git a/src/module-info.java b/src/module-info.java index 9f7b5b3..9ac12df 100644 --- a/src/module-info.java +++ b/src/module-info.java @@ -2,6 +2,7 @@ module HanoiTornyai { requires javafx.controls; requires javafx.fxml; requires javafx.graphics; + requires javafx.base; opens hanoi to javafx.graphics, javafx.fxml; }