Registrierung ergänzt und Kommentar hinzugefügt

This commit is contained in:
Kevin Maier 2023-01-31 18:36:32 +01:00
parent d222db8816
commit 9aa49d7dfe
2 changed files with 45 additions and 13 deletions

View File

@ -94,6 +94,14 @@ public class HelloController {
public TextField tfName;
@FXML
public TextField tfChild;
@FXML
public TextField tfStreet;
@FXML
public TextField tfHouseNumber;
@FXML
public TextField tfPostalCode;
@FXML
public TextField tfCity;
@FXML
private PasswordField pfPassword;
@ -279,6 +287,12 @@ public class HelloController {
+ "8: Konservierungsstoff");
}
/**
* ToRegistration() ruft die Registration-View auf, sobald man auf den Registrierungs-Button klickt
* @param event
* @throws IOException
* @author Kevin Maier
*/
@FXML
protected void ToRegistration(ActionEvent event) throws IOException
{
@ -289,6 +303,12 @@ public class HelloController {
stage.show();
}
/**
* OnRegistrationButton() lässt einen neuen Nutzer anlegen
* @param event
* @throws IOException
* @author Kevin Maier
*/
@FXML
protected void OnRegistrationButton(ActionEvent event) throws IOException
{
@ -302,7 +322,7 @@ public class HelloController {
else if (validData.validateData(tfPhone, pfPassword, this))
{
try (FileWriter writer = new FileWriter("user.txt")){
writer.write(tfName.getText() + ";" + tfPhone.getText() + ";" + tfChild.getText() + ";" + pfPassword.getText());
writer.write(tfName.getText() + ";" + tfStreet.getText() + " " + tfHouseNumber.getText() + "," + tfPostalCode + " " + tfCity.getText() + ";" + tfPhone.getText() + ";" + tfChild.getText() + ";" + pfPassword.getText());
writer.flush();
}
catch (IOException e)

View File

@ -1,14 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.14-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.vpr_javafx.HelloController">
<children>
<GridPane layoutX="100.0" layoutY="75.0" prefHeight="250.0" prefWidth="400.0">
<GridPane layoutX="50.0" layoutY="62.0" prefHeight="275.0" prefWidth="500.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="153.0" minWidth="10.0" prefWidth="89.8" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="261.0" minWidth="10.0" prefWidth="226.2" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="153.0" minWidth="10.0" prefWidth="85.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="261.0" minWidth="10.0" prefWidth="200.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="261.0" minWidth="10.0" prefWidth="200.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
@ -17,17 +19,27 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Voller Name: " />
<Label text="Handynummer: " GridPane.rowIndex="1" />
<Label text="Name" />
<Label text="Handynummer" GridPane.rowIndex="1" />
<Label prefWidth="95.0" text="Passwort: " GridPane.rowIndex="2" />
<Label text="Kind: " GridPane.rowIndex="3" />
<Button mnemonicParsing="false" onAction="#OnRegistrationButton" prefHeight="26.0" prefWidth="90.0" text="Abschicken" translateX="100.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<PasswordField fx:id="pfPassword" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<TextField fx:id="tfName" GridPane.columnIndex="1" />
<TextField fx:id="tfPhone" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<TextField fx:id="tfChild" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="Kind:" GridPane.rowIndex="5" />
<Label text="Straße" GridPane.rowIndex="3" />
<Label text="Ort" GridPane.rowIndex="4" />
<Button mnemonicParsing="false" onAction="#OnRegistrationButton" prefHeight="26.0" prefWidth="90.0" text="Abschicken" translateX="100.0" GridPane.columnIndex="1" GridPane.rowIndex="7" />
<PasswordField fx:id="pfPassword" promptText="Passwort" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<TextField fx:id="tfName" promptText="Voller Name" GridPane.columnIndex="1" />
<TextField fx:id="tfPhone" promptText="Handynummer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<TextField fx:id="tfChild" promptText="Kind" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<TextField GridPane.columnIndex="1" GridPane.rowIndex="4" />
<TextField fx:id="tfStreet" prefWidth="254.0" promptText="Straße" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<TextField fx:id="tfHouseNumber" prefWidth="123.0" promptText="Hausnummer" GridPane.columnIndex="2" GridPane.rowIndex="3"/>
<TextField fx:id="tfPostalCode" promptText="Postleitzahl" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<TextField fx:id="tfCity" promptText="Ort" GridPane.columnIndex="2" GridPane.rowIndex="4" />
</children>
</GridPane>
</children>