diff --git a/PadelMainGUIView2.fxml b/PadelMainGUIView2.fxml index 1c8f9c428c6ff6ab0cbd4d1ee1e0a80d8f818624..c11f1bcea58b77f326766ea78eee9056902767d6 100644 --- a/PadelMainGUIView2.fxml +++ b/PadelMainGUIView2.fxml @@ -9,7 +9,7 @@ <?import javafx.scene.text.Font?> -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="667.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1"> +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="667.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="HT.fx.PadelMainGUIController"> <children> <ButtonBar layoutX="200.0" layoutY="366.0" prefHeight="40.0" prefWidth="200.0" AnchorPane.bottomAnchor="-3.0" AnchorPane.leftAnchor="2.5" AnchorPane.rightAnchor="2.5"> <buttons> diff --git a/src/HT/fx/PadelMainGUIController.java b/src/HT/fx/PadelMainGUIController.java index 8cc87a916fda326a1465effc365a7bbbc738f620..fce5cb22f0e1b5c3e146304fc9c8af9246a1eb54 100644 --- a/src/HT/fx/PadelMainGUIController.java +++ b/src/HT/fx/PadelMainGUIController.java @@ -7,11 +7,13 @@ import fi.jyu.mit.fxgui.Dialogs; import fi.jyu.mit.fxgui.ModalController; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; +import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.CheckBox; import javafx.scene.control.TextField; import javafx.scene.input.MouseEvent; +import javafx.scene.layout.VBox; import javafx.stage.Stage; import HT.fx.Pelaaja; import HT.fx.Pelaajat; @@ -26,28 +28,36 @@ import HT.fx.SailoException; */ public class PadelMainGUIController { - @FXML private TextField testi; - - @FXML private CheckBox auto1; - @FXML private TextField ika1; + @FXML private VBox AutoVbox; + + @FXML private VBox IkaVbox; + + @FXML private VBox NimiVbox; - @FXML private TextField sapo1; + @FXML private VBox RatingVbox; + + @FXML private VBox SapoVbox; @FXML void handleLisaamuokkaaottelu() { handleLisaaOttelu(null, "kanat"); } @FXML void handleLisaapelaaja() { - LisaaTestiPelaajat(); - //handleLisaaPelaaja(null, "kanat"); + //LisaaTestiPelaajat(); + handleLisaaPelaaja(null, "kanat"); //LisaaPelaaja(); - Syotatiedot(); - - + //Syotatiedot(); + lisaakentat(); + syotatiedot(); } + @FXML private void lisaatekstikentta(VBox boksi) { + TextField newField = new TextField(); + boksi.getChildren().add(newField); + } + @@ -82,6 +92,27 @@ public class PadelMainGUIController { "Lisää pelaaja", modalityStage, oletus); } + /** + * Lisää tarvittavat kentät kun pelaaja luodaan + */ + public void lisaakentat() { + lisaatekstikentta(NimiVbox); + lisaatekstikentta(IkaVbox); + lisaatekstikentta(RatingVbox); + lisaatekstikentta(SapoVbox); + lisaatekstikentta(AutoVbox); + } + + public void syotatiedot() { + int i = 0; + for (Node child : NimiVbox.getChildren()) { + TextField tf = (TextField) child; + + tf.setText(karkelo.annaPelaaja(i).getNimi()); + i++; + } + } + /** * Syöttää pelaajan tiedot tekstikenttään, tällä hetkellä vain yhteen */ @@ -170,6 +201,8 @@ public class PadelMainGUIController { LisaaPelaaja(uusi6); LisaaPelaaja(uusi7); LisaaPelaaja(uusi8); + + } /** diff --git a/src/HT/fx/PadelMainGUIView.fxml b/src/HT/fx/PadelMainGUIView.fxml index 215fa8850dee8b70333f25bcecfe539bedf436ca..1f064df59e563084b1bda997700568ee791ba486 100644 --- a/src/HT/fx/PadelMainGUIView.fxml +++ b/src/HT/fx/PadelMainGUIView.fxml @@ -1,79 +1,79 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.geometry.Insets?> <?import javafx.scene.control.Button?> -<?import javafx.scene.control.CheckBox?> +<?import javafx.scene.control.ButtonBar?> <?import javafx.scene.control.Label?> -<?import javafx.scene.control.TextField?> -<?import javafx.scene.control.ToolBar?> -<?import javafx.scene.layout.BorderPane?> -<?import javafx.scene.layout.ColumnConstraints?> -<?import javafx.scene.layout.GridPane?> -<?import javafx.scene.layout.Pane?> -<?import javafx.scene.layout.RowConstraints?> +<?import javafx.scene.control.ScrollPane?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.VBox?> +<?import javafx.scene.text.Font?> -<BorderPane xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="HT.fx.PadelMainGUIController"> - <center> - <BorderPane prefHeight="519.0" prefWidth="523.0" BorderPane.alignment="CENTER"> - <left> - <GridPane prefHeight="502.0" prefWidth="533.0" BorderPane.alignment="CENTER"> - <columnConstraints> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="112.0" minWidth="10.0" prefWidth="112.0" /> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="101.0" minWidth="10.0" prefWidth="33.0" /> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="185.0" minWidth="10.0" prefWidth="46.0" /> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="254.0" minWidth="10.0" prefWidth="195.0" /> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="98.0" minWidth="10.0" prefWidth="83.0" /> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="98.0" minWidth="10.0" prefWidth="64.0" /> - </columnConstraints> - <rowConstraints> - <RowConstraints maxHeight="364.0" minHeight="0.0" prefHeight="47.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="402.0" minHeight="0.0" prefHeight="49.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="475.0" minHeight="0.0" prefHeight="41.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="475.0" minHeight="0.0" prefHeight="54.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="475.0" minHeight="10.0" prefHeight="45.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="475.0" minHeight="10.0" prefHeight="229.0" vgrow="SOMETIMES" /> - <RowConstraints maxHeight="475.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> - </rowConstraints> +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="667.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="HT.fx.PadelMainGUIController"> + <children> + <ButtonBar layoutX="200.0" layoutY="366.0" prefHeight="40.0" prefWidth="200.0" AnchorPane.bottomAnchor="-3.0" AnchorPane.leftAnchor="2.5" AnchorPane.rightAnchor="2.5"> + <buttons> + <Button mnemonicParsing="false" onMouseClicked="#handleLisaamuokkaaottelu" text="Lisää ottelu" /> + <Button mnemonicParsing="false" onMouseClicked="#handleLisaapelaaja" text="Lisää pelaaja" /> + </buttons> + </ButtonBar> + <Label layoutX="14.0" layoutY="6.0" text="Padelkerho" AnchorPane.leftAnchor="2.5" AnchorPane.topAnchor="2.5"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Label> + <ScrollPane layoutX="3.0" layoutY="30.0" AnchorPane.bottomAnchor="35.0" AnchorPane.leftAnchor="3.0" AnchorPane.rightAnchor="160.0" AnchorPane.topAnchor="30.0"> + <content> + <HBox prefHeight="335.0" prefWidth="452.0"> <children> - <Label text="Padelkerho" /> - <Label text="Pelaajien tiedot" GridPane.rowIndex="1" /> - <Label text="Nimi" GridPane.rowIndex="2" /> - <Label text="Ikä" GridPane.columnIndex="1" GridPane.rowIndex="2" /> - <Label text="Ranking" GridPane.columnIndex="2" GridPane.rowIndex="2" /> - <Label text="Sähköposti" GridPane.columnIndex="3" GridPane.rowIndex="2" /> - <Label text="Onko autoa ?" GridPane.columnIndex="4" GridPane.rowIndex="2" /> - <Label text="Muokkaa" GridPane.columnIndex="5" GridPane.rowIndex="2" /> - <TextField fx:id="testi" GridPane.rowIndex="3" /> - <TextField fx:id="ika1" GridPane.columnIndex="1" GridPane.rowIndex="3" /> - <TextField GridPane.columnIndex="2" GridPane.rowIndex="3" /> - <TextField fx:id="sapo1" GridPane.columnIndex="3" GridPane.rowIndex="3" /> - <CheckBox fx:id="auto1" mnemonicParsing="false" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="3"> - <GridPane.margin> - <Insets /> - </GridPane.margin> - </CheckBox> - <Button minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="5" GridPane.halignment="CENTER" GridPane.rowIndex="3" /> - <TextField GridPane.rowIndex="4" /> - <TextField GridPane.columnIndex="1" GridPane.rowIndex="4" /> - <TextField GridPane.columnIndex="2" GridPane.rowIndex="4" /> - <TextField GridPane.columnIndex="3" GridPane.rowIndex="4" /> - <CheckBox mnemonicParsing="false" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="4" /> - <Button minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="5" GridPane.halignment="CENTER" GridPane.rowIndex="4" /> + <VBox fx:id="NimiVbox" prefHeight="100.0" prefWidth="150.0"> + <children> + <Label text="Nimi"> + <font> + <Font size="14.0" /> + </font> + </Label> + </children> + </VBox> + <VBox fx:id="IkaVbox" prefHeight="100.0" prefWidth="34.0"> + <children> + <Label text="Ikä"> + <font> + <Font size="14.0" /> + </font> + </Label> + </children> + </VBox> + <VBox fx:id="RatingVbox" prefHeight="335.0" prefWidth="43.0"> + <children> + <Label text="Rating"> + <font> + <Font size="14.0" /> + </font> + </Label> + </children> + </VBox> + <VBox fx:id="SapoVbox" prefHeight="100.0" prefWidth="188.0"> + <children> + <Label text="Sähköposti"> + <font> + <Font size="14.0" /> + </font> + </Label> + </children> + </VBox> + <VBox fx:id="AutoVbox" prefHeight="100.0" prefWidth="35.0"> + <children> + <Label text="Auto?"> + <font> + <Font size="14.0" /> + </font> + </Label> + </children> + </VBox> </children> - </GridPane> - </left> - <bottom> - <Pane prefHeight="33.0" prefWidth="533.0" BorderPane.alignment="CENTER"> - <children> - <ToolBar layoutX="285.0" layoutY="-6.0" prefHeight="40.0" prefWidth="248.0"> - <items> - <Button mnemonicParsing="false" onMouseClicked="#handleLisaamuokkaaottelu" text="Lisää / muokkaa ottelu" /> - <Button mnemonicParsing="false" onMouseClicked="#handleLisaapelaaja" text="Lisää pelaaja" /> - </items> - </ToolBar> - </children> - </Pane> - </bottom> - </BorderPane> - </center> -</BorderPane> + </HBox> + </content> + </ScrollPane> + </children> +</AnchorPane>