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; }