A Foablak grafikus felületének létrehozása.

A FoAblakController kódjának beillesztése.
This commit is contained in:
pp 2021-10-11 13:59:04 +02:00
parent d9741fc7a2
commit 27f6ff633c
3 changed files with 85 additions and 5 deletions

View File

@ -1,7 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.BorderPane?>
<BorderPane xmlns:fx="http://javafx.com/fxml/1" fx:controller="hanoi.FoablakController">
<!-- TODO Add Nodes -->
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<BorderPane prefHeight="400.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hanoi.FoablakController">
<top>
<MenuBar BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
</top>
<center>
<Pane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<Label layoutX="55.0" layoutY="77.0" text="Játékos neve:" />
<TextField fx:id="nevMezo" layoutX="135.0" layoutY="73.0" prefHeight="25.0" prefWidth="205.0" />
<Spinner fx:id="kspin" layoutX="135.0" layoutY="145.0" prefHeight="25.0" prefWidth="89.0" />
<Label layoutX="34.0" layoutY="149.0" text="Korongok száma:" />
<Button fx:id="playGomb" layoutX="61.0" layoutY="224.0" mnemonicParsing="false" onAction="#playGombAction" prefHeight="40.0" prefWidth="279.0" style="-fx-background-color: lightblue;" text="Játék indítása">
<font>
<Font name="Arial Bold" size="18.0" />
</font>
</Button>
</children>
</Pane>
</center>
</BorderPane>

View File

@ -1,5 +1,40 @@
package hanoi;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Spinner;
import javafx.scene.control.TextField;
public class FoablakController {
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML
private TextField nevMezo;
@FXML
private Spinner<?> kspin;
@FXML
private Button playGomb;
@FXML
void playGombAction(ActionEvent event) {
}
@FXML
void initialize() {
assert nevMezo != null : "fx:id=\"nevMezo\" was not injected: check your FXML file 'Foablak.fxml'.";
assert kspin != null : "fx:id=\"kspin\" was not injected: check your FXML file 'Foablak.fxml'.";
assert playGomb != null : "fx:id=\"playGomb\" was not injected: check your FXML file 'Foablak.fxml'.";
nevMezo.setText("Névtelen");
}
}

View File

@ -15,6 +15,7 @@ public class Main extends Application {
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.setTitle("Hanoi tornyai játék");
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();