Login und SingUp aktuallisiert

This commit is contained in:
2023-01-18 22:32:38 +01:00
parent dd69909b16
commit a3c3ee0fe0
4 changed files with 51 additions and 30 deletions

View File

@@ -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) {

View File

@@ -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<String,String> benutzerMap = new HashMap<String,String>();
@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();
}
}