diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/HelloApplication.java b/src/main/java/com/bib/essensbestellungsverwaltung/HelloApplication.java index e0045a2..cd4f503 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/HelloApplication.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/HelloApplication.java @@ -1,3 +1,8 @@ +/** + * @autor: Reshad Meher + * Fenstergrößer + * Fenstertitle + */ package com.bib.essensbestellungsverwaltung; import javafx.application.Application; @@ -8,18 +13,17 @@ import javafx.stage.Stage; import java.io.IOException; public class HelloApplication extends Application { + public static Stage primary; @Override public void start(Stage stage) throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); - /** - * @autor: Reshad Meher - * Fenstergrößer - * Fenstertitle - */ - Scene scene = new Scene(fxmlLoader.load(), 480, 280); + FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("login-view.fxml")); + Scene scene = new Scene(fxmlLoader.load(), 950,480); + //stage = primary; stage.setTitle("Essen Bestellung im Kindergarten"); stage.setScene(scene); stage.show(); + + } public static void main(String[] args) { diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java b/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java index 2cc1492..6f3de77 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/LoginController.java @@ -3,9 +3,17 @@ package com.bib.essensbestellungsverwaltung; import javafx.beans.NamedArg; import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; +import javafx.stage.Stage; + +import java.io.IOException; +import java.util.HashMap; + public class LoginController { @FXML private TextField tfEmail; @@ -13,26 +21,35 @@ public class LoginController { @FXML private PasswordField pfPassword; + HashMap benutzerMap = new HashMap(); @FXML - private Button btLogin; - - @FXML - private Button btSignUp; - - - - @FXML - protected void onBtLoginClick(){ + protected void onBtLoginClick() throws IOException { + benutzerMap.put("Reshad","1234"); String email = tfEmail.getText(); String password = pfPassword.getText(); - - + if(benutzerMap.containsKey(email) && benutzerMap.containsValue(password)){ + FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("menue-view.fxml")); + Scene scene = new Scene(fxmlLoader.load(), 950,480); + Stage stage = new Stage(); + stage.setTitle("Essen Bestellung im Kindergarten"); + stage.setScene(scene); + stage.show(); + }else { + Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch"); + alert.showAndWait(); + } tfEmail.setText(""); pfPassword.setText(""); } @FXML - protected void changeToSignUp(){ + protected void changeToSignUp() throws IOException { + FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("signUp-view.fxml")); + Scene scene = new Scene(fxmlLoader.load(), 950,480); + Stage stage = new Stage(); + stage.setTitle("Essen Bestellung im Kindergarten"); + stage.setScene(scene); + stage.show(); } } diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/login-view.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/login-view.fxml index 732b25a..5fe69b5 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/login-view.fxml +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/login-view.fxml @@ -31,7 +31,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -52,11 +52,11 @@ - - -