diff --git a/client/app/src/main/java/main/MainApplication.java b/client/app/src/main/java/main/MainApplication.java index 6efcaa1..84388ab 100644 --- a/client/app/src/main/java/main/MainApplication.java +++ b/client/app/src/main/java/main/MainApplication.java @@ -12,13 +12,17 @@ import java.util.Objects; public class MainApplication extends Application { @Override public void start(Stage stage) throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml")); + //wieder ändern zu main-view.fxml + FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("../users/create-user.fxml")); Scene scene = new Scene(fxmlLoader.load(), 1200, 700); scene.getStylesheets().add(Objects.requireNonNull( - MainApplication.class.getResource("main-view.css")).toExternalForm()); + //wieder ändern zu main-view.css + MainApplication.class.getResource("../users/create-user.css")).toExternalForm()); stage.setTitle("SharePlaner"); stage.setScene(scene); + //wieder löschen + stage.show(); FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml")); Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500); diff --git a/client/app/src/main/java/users/CreateUserController.java b/client/app/src/main/java/users/CreateUserController.java index 231bd99..e5f2b4a 100644 --- a/client/app/src/main/java/users/CreateUserController.java +++ b/client/app/src/main/java/users/CreateUserController.java @@ -1,7 +1,13 @@ package users; +import javafx.event.ActionEvent; +import javafx.scene.Node; import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.stage.Stage; + +import java.util.Objects; public class CreateUserController { @@ -9,4 +15,27 @@ public class CreateUserController { public TextField textPassword; public TextField textPasswordSecond; public CheckBox checkBoxIsAdmin; + public Label labelErrorName; + public Label labelErrorPw; + + protected void createUser(ActionEvent event) { + if (textName.getText().trim().isEmpty()) { + labelErrorName.setText("Bitte Usernamen eingeben!"); + labelErrorPw.setText(""); + return; + } + if (textPassword.getText().trim().isEmpty()) { + labelErrorName.setText(""); + labelErrorPw.setText("Bitte Passwort eingeben!"); + return; + } + if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){ + labelErrorName.setText(""); + labelErrorPw.setText("Passwörter stimmen nicht überein!"); + return; + } + + Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); + stage.close(); + } } diff --git a/client/app/src/main/resources/users/create-user.fxml b/client/app/src/main/resources/users/create-user.fxml index 837a733..29132d8 100644 --- a/client/app/src/main/resources/users/create-user.fxml +++ b/client/app/src/main/resources/users/create-user.fxml @@ -9,6 +9,7 @@ + @@ -17,19 +18,23 @@ + - + - - - - + + + + + +