Új játék menüpont és beállítások ablak

This commit is contained in:
pp 2021-12-02 12:57:40 +01:00
parent 17a6c9b10f
commit 15adbcef20
3 changed files with 35 additions and 3 deletions

17
src/hanoi/Beallitas.fxml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane prefHeight="400.0" prefWidth="400.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/16">
<children>
<Button fx:id="mentGomb" layoutX="135.0" layoutY="296.0" mnemonicParsing="false" onAction="#mentGombAction" text="Mentés és kilépés" />
<Label layoutX="45.0" layoutY="63.0" text="Alapértelmezett korongszám:" />
<Spinner fx:id="defaultKszamSpin" layoutX="214.0" layoutY="59.0" prefHeight="25.0" prefWidth="101.0" />
<Label layoutX="105.0" layoutY="116.0" text="Lépésszám-korlát:" />
<Spinner fx:id="stepMaxSpin" layoutX="214.0" layoutY="112.0" prefHeight="25.0" prefWidth="101.0" />
</children>
</AnchorPane>

View File

@ -49,6 +49,7 @@ public class FoablakController {
st.show();
// a felhasználó és korongszám átadása a hanoi ablaknak
HanoiFormController hfc = fl.getController();
hfc.setFoAblak(n.getScene());
hfc.setFh(fh);
hfc.setKorongokSzama(kspin.getValue());
}

View File

@ -8,6 +8,7 @@ import java.util.ResourceBundle;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
@ -22,9 +23,17 @@ import javafx.stage.Stage;
public class HanoiFormController {
private Korong kezbeKorong;
private Korong kezbeKorong;
@FXML
private Scene foAblak;
public void setFoAblak(Scene foAblak) {
this.foAblak = foAblak;
}
@FXML
private MenuItem ujItem;
@FXML
@ -89,7 +98,12 @@ public class HanoiFormController {
@FXML
void ujKattintas(ActionEvent event) {
Stage st = (Stage) jatekTerulet.getScene().getWindow();
if (foAblak!=null) {
st.setScene(foAblak);
st.show();
}
}
@FXML