Skip to content
Snippets Groups Projects
Commit 4d4eccc5 authored by joonatan's avatar joonatan
Browse files

Pääikkunan ulkonäkö muutette siten että tiedot mahdollista syöttää siihen

parent a63d428b
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<?import javafx.scene.text.Font?> <?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> <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"> <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> <buttons>
......
...@@ -7,11 +7,13 @@ import fi.jyu.mit.fxgui.Dialogs; ...@@ -7,11 +7,13 @@ import fi.jyu.mit.fxgui.Dialogs;
import fi.jyu.mit.fxgui.ModalController; import fi.jyu.mit.fxgui.ModalController;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.stage.Stage; import javafx.stage.Stage;
import HT.fx.Pelaaja; import HT.fx.Pelaaja;
import HT.fx.Pelaajat; import HT.fx.Pelaajat;
...@@ -26,28 +28,36 @@ import HT.fx.SailoException; ...@@ -26,28 +28,36 @@ import HT.fx.SailoException;
*/ */
public class PadelMainGUIController { 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() { @FXML void handleLisaamuokkaaottelu() {
handleLisaaOttelu(null, "kanat"); handleLisaaOttelu(null, "kanat");
} }
@FXML void handleLisaapelaaja() { @FXML void handleLisaapelaaja() {
LisaaTestiPelaajat(); //LisaaTestiPelaajat();
//handleLisaaPelaaja(null, "kanat"); handleLisaaPelaaja(null, "kanat");
//LisaaPelaaja(); //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 { ...@@ -82,6 +92,27 @@ public class PadelMainGUIController {
"Lisää pelaaja", modalityStage, oletus); "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 * Syöttää pelaajan tiedot tekstikenttään, tällä hetkellä vain yhteen
*/ */
...@@ -170,6 +201,8 @@ public class PadelMainGUIController { ...@@ -170,6 +201,8 @@ public class PadelMainGUIController {
LisaaPelaaja(uusi6); LisaaPelaaja(uusi6);
LisaaPelaaja(uusi7); LisaaPelaaja(uusi7);
LisaaPelaaja(uusi8); LisaaPelaaja(uusi8);
} }
/** /**
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?> <?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.ToolBar?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.ColumnConstraints?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.GridPane?> <?import javafx.scene.text.Font?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<BorderPane xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="HT.fx.PadelMainGUIController"> <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">
<center> <children>
<BorderPane prefHeight="519.0" prefWidth="523.0" BorderPane.alignment="CENTER"> <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">
<left> <buttons>
<GridPane prefHeight="502.0" prefWidth="533.0" BorderPane.alignment="CENTER"> <Button mnemonicParsing="false" onMouseClicked="#handleLisaamuokkaaottelu" text="Lisää ottelu" />
<columnConstraints> <Button mnemonicParsing="false" onMouseClicked="#handleLisaapelaaja" text="Lisää pelaaja" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="112.0" minWidth="10.0" prefWidth="112.0" /> </buttons>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="101.0" minWidth="10.0" prefWidth="33.0" /> </ButtonBar>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="185.0" minWidth="10.0" prefWidth="46.0" /> <Label layoutX="14.0" layoutY="6.0" text="Padelkerho" AnchorPane.leftAnchor="2.5" AnchorPane.topAnchor="2.5">
<ColumnConstraints hgrow="SOMETIMES" maxWidth="254.0" minWidth="10.0" prefWidth="195.0" /> <font>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="98.0" minWidth="10.0" prefWidth="83.0" /> <Font name="System Bold" size="24.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="98.0" minWidth="10.0" prefWidth="64.0" /> </font>
</columnConstraints> </Label>
<rowConstraints> <ScrollPane layoutX="3.0" layoutY="30.0" AnchorPane.bottomAnchor="35.0" AnchorPane.leftAnchor="3.0" AnchorPane.rightAnchor="160.0" AnchorPane.topAnchor="30.0">
<RowConstraints maxHeight="364.0" minHeight="0.0" prefHeight="47.0" vgrow="SOMETIMES" /> <content>
<RowConstraints maxHeight="402.0" minHeight="0.0" prefHeight="49.0" vgrow="SOMETIMES" /> <HBox prefHeight="335.0" prefWidth="452.0">
<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>
<children> <children>
<Label text="Padelkerho" /> <VBox fx:id="NimiVbox" prefHeight="100.0" prefWidth="150.0">
<Label text="Pelaajien tiedot" GridPane.rowIndex="1" /> <children>
<Label text="Nimi" GridPane.rowIndex="2" /> <Label text="Nimi">
<Label text="Ikä" GridPane.columnIndex="1" GridPane.rowIndex="2" /> <font>
<Label text="Ranking" GridPane.columnIndex="2" GridPane.rowIndex="2" /> <Font size="14.0" />
<Label text="Sähköposti" GridPane.columnIndex="3" GridPane.rowIndex="2" /> </font>
<Label text="Onko autoa ?" GridPane.columnIndex="4" GridPane.rowIndex="2" /> </Label>
<Label text="Muokkaa" GridPane.columnIndex="5" GridPane.rowIndex="2" /> </children>
<TextField fx:id="testi" GridPane.rowIndex="3" /> </VBox>
<TextField fx:id="ika1" GridPane.columnIndex="1" GridPane.rowIndex="3" /> <VBox fx:id="IkaVbox" prefHeight="100.0" prefWidth="34.0">
<TextField GridPane.columnIndex="2" GridPane.rowIndex="3" /> <children>
<TextField fx:id="sapo1" GridPane.columnIndex="3" GridPane.rowIndex="3" /> <Label text="Ikä">
<CheckBox fx:id="auto1" mnemonicParsing="false" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="3"> <font>
<GridPane.margin> <Font size="14.0" />
<Insets /> </font>
</GridPane.margin> </Label>
</CheckBox> </children>
<Button minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="5" GridPane.halignment="CENTER" GridPane.rowIndex="3" /> </VBox>
<TextField GridPane.rowIndex="4" /> <VBox fx:id="RatingVbox" prefHeight="335.0" prefWidth="43.0">
<TextField GridPane.columnIndex="1" GridPane.rowIndex="4" /> <children>
<TextField GridPane.columnIndex="2" GridPane.rowIndex="4" /> <Label text="Rating">
<TextField GridPane.columnIndex="3" GridPane.rowIndex="4" /> <font>
<CheckBox mnemonicParsing="false" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="4" /> <Font size="14.0" />
<Button minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="5" GridPane.halignment="CENTER" GridPane.rowIndex="4" /> </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> </children>
</GridPane> </HBox>
</left> </content>
<bottom> </ScrollPane>
<Pane prefHeight="33.0" prefWidth="533.0" BorderPane.alignment="CENTER"> </children>
<children> </AnchorPane>
<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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment