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.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
@ -20,6 +21,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class HelloController {
|
||||
|
||||
@FXML
|
||||
private Label lMonH1;
|
||||
@FXML
|
||||
@ -84,6 +86,11 @@ public class HelloController {
|
||||
|
||||
@FXML
|
||||
private TextField tfPhone;
|
||||
@FXML
|
||||
public TextField tfName;
|
||||
@FXML
|
||||
public TextField tfChild;
|
||||
|
||||
@FXML
|
||||
private PasswordField pfPassword;
|
||||
@FXML
|
||||
@ -244,4 +251,26 @@ public class HelloController {
|
||||
+ "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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,20 +17,17 @@
|
||||
<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 prefWidth="95.0" text="Passwort: " GridPane.rowIndex="2" />
|
||||
<Label text="Kind: " GridPane.rowIndex="4" />
|
||||
<Button onAction="OnRegistrationButton" mnemonicParsing="false" prefHeight="26.0" prefWidth="90.0" text="Abschicken" translateX="100.0" GridPane.columnIndex="1" GridPane.rowIndex="6" />
|
||||
<Label text="Passwort bestätigen: " GridPane.rowIndex="3" />
|
||||
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||
<TextField fx:id="tfRegisterName" GridPane.columnIndex="1" />
|
||||
<TextField fx:id="tfRegisterPhone" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||
<TextField fx:id="tfRegisterChild" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
||||
<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" />
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
|
Loading…
Reference in New Issue
Block a user