Registrireung weiterentwickelt
This commit is contained in:
parent
ae62ff5fd7
commit
e54ce035e0
@ -13,6 +13,7 @@ import javafx.stage.Stage;
|
|||||||
|
|
||||||
import java.io.Console;
|
import java.io.Console;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -20,6 +21,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class HelloController {
|
public class HelloController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label lMonH1;
|
private Label lMonH1;
|
||||||
@FXML
|
@FXML
|
||||||
@ -84,6 +86,11 @@ public class HelloController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TextField tfPhone;
|
private TextField tfPhone;
|
||||||
|
@FXML
|
||||||
|
public TextField tfName;
|
||||||
|
@FXML
|
||||||
|
public TextField tfChild;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private PasswordField pfPassword;
|
private PasswordField pfPassword;
|
||||||
@FXML
|
@FXML
|
||||||
@ -235,7 +242,7 @@ public class HelloController {
|
|||||||
+ "k: Nüsse; l: Sellerie;\n"
|
+ "k: Nüsse; l: Sellerie;\n"
|
||||||
+ "m: Fische; n: Lupinen\n\n"
|
+ "m: Fische; n: Lupinen\n\n"
|
||||||
+ "1: Nitrit-Pökelsalz\n"
|
+ "1: Nitrit-Pökelsalz\n"
|
||||||
+ "2:Phosphat\n"
|
+ "2: Phosphat\n"
|
||||||
+ "3: Nitrat\n"
|
+ "3: Nitrat\n"
|
||||||
+ "4: Antioxidationsmittel\n"
|
+ "4: Antioxidationsmittel\n"
|
||||||
+ "5: Farbstoff\n"
|
+ "5: Farbstoff\n"
|
||||||
@ -244,4 +251,26 @@ public class HelloController {
|
|||||||
+ "8: Konservierungsstoff");
|
+ "8: Konservierungsstoff");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void OnRegistrationButton(ActionEvent event) throws IOException
|
||||||
|
{
|
||||||
|
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||||
|
Data validData = new Data("user.txt");
|
||||||
|
|
||||||
|
if (tfName.getText().isEmpty() || tfPhone.getText().isEmpty() || tfChild.getText().isEmpty())
|
||||||
|
{
|
||||||
|
alert.setContentText("Registrierungsdaten unvollständig");
|
||||||
|
}
|
||||||
|
else if (validData.validateData(tfPhone, pfPassword))
|
||||||
|
{
|
||||||
|
try (FileWriter writer = new FileWriter("user.txt")){
|
||||||
|
writer.write(tfName.getText() + ";" + tfPhone.getText() + ";" + tfChild.getText() + ";" + pfPassword.getText());
|
||||||
|
writer.flush();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,34 +4,31 @@
|
|||||||
<?import javafx.scene.layout.*?>
|
<?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">
|
<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>
|
<children>
|
||||||
<GridPane layoutX="100.0" layoutY="75.0" prefHeight="250.0" prefWidth="400.0">
|
<GridPane layoutX="100.0" layoutY="75.0" prefHeight="250.0" prefWidth="400.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="153.0" minWidth="10.0" prefWidth="89.8" />
|
<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="261.0" minWidth="10.0" prefWidth="226.2" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<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 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 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>
|
||||||
</rowConstraints>
|
<children>
|
||||||
<children>
|
<Label text="Voller Name: " />
|
||||||
<Label text="Voller Name: " />
|
<Label text="Handynummer: " GridPane.rowIndex="1" />
|
||||||
<Label text="Handynummer: " GridPane.rowIndex="1" />
|
<Label prefWidth="95.0" text="Passwort: " GridPane.rowIndex="2" />
|
||||||
<Label prefWidth="95.0" text="Passwort: " GridPane.rowIndex="2" />
|
<Label text="Kind: " GridPane.rowIndex="3" />
|
||||||
<Label text="Kind: " GridPane.rowIndex="4" />
|
<Button mnemonicParsing="false" onAction="#OnRegistrationButton" prefHeight="26.0" prefWidth="90.0" text="Abschicken" translateX="100.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
||||||
<Button onAction="OnRegistrationButton" mnemonicParsing="false" prefHeight="26.0" prefWidth="90.0" text="Abschicken" translateX="100.0" GridPane.columnIndex="1" GridPane.rowIndex="6" />
|
<PasswordField fx:id="pfPassword" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||||
<Label text="Passwort bestätigen: " GridPane.rowIndex="3" />
|
<TextField fx:id="tfName" GridPane.columnIndex="1" />
|
||||||
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
<TextField fx:id="tfPhone" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
<TextField fx:id="tfChild" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||||
<TextField fx:id="tfRegisterName" GridPane.columnIndex="1" />
|
</children>
|
||||||
<TextField fx:id="tfRegisterPhone" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
</GridPane>
|
||||||
<TextField fx:id="tfRegisterChild" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
</children>
|
||||||
</children>
|
</AnchorPane>
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
Loading…
Reference in New Issue
Block a user