A előzetesen megtervezett hanoi játékablakot behoztuk a projektbe és
kontrollert adtunk hozzá.
This commit is contained in:
parent
27f6ff633c
commit
b18a10d90e
|
@ -6,6 +6,7 @@ import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Spinner;
|
import javafx.scene.control.Spinner;
|
||||||
|
import javafx.scene.control.SpinnerValueFactory;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
|
||||||
public class FoablakController {
|
public class FoablakController {
|
||||||
|
@ -20,7 +21,7 @@ public class FoablakController {
|
||||||
private TextField nevMezo;
|
private TextField nevMezo;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Spinner<?> kspin;
|
private Spinner<Integer> kspin;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button playGomb;
|
private Button playGomb;
|
||||||
|
@ -36,5 +37,7 @@ public class FoablakController {
|
||||||
assert kspin != null : "fx:id=\"kspin\" 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'.";
|
assert playGomb != null : "fx:id=\"playGomb\" was not injected: check your FXML file 'Foablak.fxml'.";
|
||||||
nevMezo.setText("Névtelen");
|
nevMezo.setText("Névtelen");
|
||||||
|
SpinnerValueFactory<Integer> valueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(4, 10, 6);
|
||||||
|
kspin.setValueFactory(valueFactory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
53
src/hanoi/HanoiFormController.java
Normal file
53
src/hanoi/HanoiFormController.java
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
package hanoi;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.shape.Rectangle;
|
||||||
|
|
||||||
|
public class HanoiFormController {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ResourceBundle resources;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private URL location;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Rectangle elsoRudRect;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Rectangle masodikRudRect;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Rectangle harmadikRudRect;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Pane felvettPane;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void elsoRudClick(MouseEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void harmadikRudClick(MouseEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void masodikRudClick(MouseEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void initialize() {
|
||||||
|
assert elsoRudRect != null : "fx:id=\"elsoRudRect\" was not injected: check your FXML file 'hanoi_form2.fxml'.";
|
||||||
|
assert masodikRudRect != null : "fx:id=\"masodikRudRect\" was not injected: check your FXML file 'hanoi_form2.fxml'.";
|
||||||
|
assert harmadikRudRect != null : "fx:id=\"harmadikRudRect\" was not injected: check your FXML file 'hanoi_form2.fxml'.";
|
||||||
|
assert felvettPane != null : "fx:id=\"felvettPane\" was not injected: check your FXML file 'hanoi_form2.fxml'.";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
86
src/hanoi/hanoi_form2.fxml
Normal file
86
src/hanoi/hanoi_form2.fxml
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2015, 2019, Gluon and/or its affiliates.
|
||||||
|
All rights reserved. Use is subject to license terms.
|
||||||
|
|
||||||
|
This file is available and licensed under the following license:
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the distribution.
|
||||||
|
- Neither the name of Oracle Corporation nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.Menu?>
|
||||||
|
<?import javafx.scene.control.MenuBar?>
|
||||||
|
<?import javafx.scene.control.MenuItem?>
|
||||||
|
<?import javafx.scene.control.SeparatorMenuItem?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.shape.Rectangle?>
|
||||||
|
|
||||||
|
<VBox prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hanoi.HanoiFormController">
|
||||||
|
<children>
|
||||||
|
<MenuBar VBox.vgrow="NEVER">
|
||||||
|
<menus>
|
||||||
|
<Menu mnemonicParsing="false" text="Fájl">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="New" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Open…" />
|
||||||
|
<Menu mnemonicParsing="false" text="Open Recent" />
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Close" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Save" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Save As…" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Revert" />
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Preferences…" />
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem mnemonicParsing="false" text="Quit" />
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
<Menu mnemonicParsing="false" text="Súgó">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="About MyHelloApp" />
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
</menus>
|
||||||
|
</MenuBar>
|
||||||
|
<AnchorPane maxHeight="-1.0" maxWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
|
||||||
|
<children>
|
||||||
|
<Rectangle fx:id="elsoRudRect" arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="303.0" layoutX="140.0" layoutY="81.0" onMouseClicked="#elsoRudClick" stroke="BLACK" strokeType="INSIDE" width="8.0" />
|
||||||
|
<Rectangle fx:id="masodikRudRect" arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="303.0" layoutX="310.0" layoutY="81.0" onMouseClicked="#masodikRudClick" stroke="BLACK" strokeType="INSIDE" width="8.0" />
|
||||||
|
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="15.0" layoutY="384.0" stroke="BLACK" strokeType="INSIDE" width="640.0" />
|
||||||
|
<Rectangle fx:id="harmadikRudRect" arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="303.0" layoutX="480.0" layoutY="81.0" onMouseClicked="#harmadikRudClick" stroke="BLACK" strokeType="INSIDE" width="8.0" />
|
||||||
|
<Pane fx:id="felvettPane" layoutX="133.0" layoutY="4.0" prefHeight="30.0" prefWidth="352.0">
|
||||||
|
<children>
|
||||||
|
<Label layoutX="13.0" layoutY="5.0" prefHeight="17.0" prefWidth="155.0" text="A felemelt korong:" />
|
||||||
|
</children>
|
||||||
|
</Pane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
Loading…
Reference in New Issue
Block a user