Login und SingUp aktuallisiert

This commit is contained in:
Reshad Meher 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();
}
}

View File

@ -31,7 +31,7 @@
<Circle fill="#93c4f23d" layoutY="258.0" radius="106.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" />
<VBox alignment="CENTER" layoutX="263.0" prefHeight="400.0" prefWidth="338.0" style="-fx-background-color: white;">
<children>
<TextField promptText="Email" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField promptText="Email" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;" fx:id="tfEmail">
<VBox.margin>
<Insets bottom="15.0" left="25.0" right="25.0" top="25.0" />
</VBox.margin>
@ -42,7 +42,7 @@
<Font name="Microsoft Tai Le" size="12.0" />
</font>
</TextField>
<PasswordField promptText="Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<PasswordField promptText="Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;" fx:id="pfPassword">
<VBox.margin>
<Insets bottom="25.0" left="25.0" right="25.0" top="15.0" />
</VBox.margin>
@ -52,11 +52,11 @@
</PasswordField>
<HBox alignment="CENTER" prefHeight="30.0" prefWidth="238.0">
<children>
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="106.0" style="-fx-background-radius: 25; -fx-background-color: lightblue;" text="Login" textFill="WHITE">
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="106.0" style="-fx-background-radius: 25; -fx-background-color: lightblue;" text="Login" textFill="WHITE" onAction="#onBtLoginClick">
<font>
<Font name="Microsoft Tai Le Bold" size="12.0" />
</font></Button>
<Button id="btSignUp" mnemonicParsing="false" prefHeight="25.0" prefWidth="101.0" style="-fx-background-color: tranparent;" text="Sign up" textFill="#7c7b7b" underline="true" />
<Button id="btSignUp" mnemonicParsing="false" prefHeight="25.0" prefWidth="101.0" style="-fx-background-color: tranparent;" text="Sign up" textFill="#7c7b7b" underline="true" onAction="#changeToSignUp" />
</children>
</HBox>
</children>

View File

@ -12,7 +12,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane maxHeight="-400" maxWidth="-600" minHeight="-400" minWidth="-600" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.AdminController">
<AnchorPane maxHeight="-400" maxWidth="-600" minHeight="-400" minWidth="-600" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.SingUpController">
<children>
<VBox alignment="CENTER" prefHeight="400.0" prefWidth="265.0" style="-fx-background-color: lightblue;">
<children>
@ -31,7 +31,7 @@
<Circle fill="#93c4f23d" layoutY="258.0" radius="106.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" />
<VBox alignment="CENTER" layoutX="263.0" prefHeight="400.0" prefWidth="338.0" style="-fx-background-color: white;">
<children>
<TextField promptText="Email" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField promptText="Email" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;" fx:id="tfEmail">
<effect>
<Blend />
</effect>
@ -42,7 +42,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin>
</TextField>
<TextField promptText="Email bestätigen" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<TextField promptText="Email bestätigen" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;" fx:id="tfBestätigungEmail">
<effect>
<Blend />
</effect>
@ -53,7 +53,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin>
</TextField>
<PasswordField promptText="Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<PasswordField promptText="Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;" fx:id="pfPasswort">
<font>
<Font name="Microsoft Tai Le Bold" size="12.0" />
</font>
@ -67,7 +67,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin>
</PasswordField>
<PasswordField promptText="Passwort bestätigen" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
<PasswordField promptText="Passwort bestätigen" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;" fx:id="pfBestätigungPassowrt">
<font>
<Font name="Microsoft Tai Le Bold" size="12.0" />
</font>
@ -83,11 +83,11 @@
</PasswordField>
<HBox alignment="CENTER" prefHeight="30.0" prefWidth="238.0">
<children>
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="106.0" style="-fx-background-radius: 25; -fx-background-color: lightblue;" text="Konto erstellen" textFill="WHITE">
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="106.0" style="-fx-background-radius: 25; -fx-background-color: lightblue;" text="Konto erstellen" textFill="WHITE" onAction="#onKontoErstellenBtClick">
<font>
<Font name="Microsoft Tai Le Bold" size="12.0" />
</font></Button>
<Button id="btSignUp" mnemonicParsing="false" prefHeight="25.0" prefWidth="101.0" style="-fx-background-color: tranparent;" text="Anmelden" textFill="#7c7b7b" underline="true" />
<Button id="btSignUp" mnemonicParsing="false" prefHeight="25.0" prefWidth="101.0" style="-fx-background-color: tranparent;" text="Anmelden" textFill="#7c7b7b" underline="true" onAction="#onAnmeldenBtClick"/>
</children>
<opaqueInsets>
<Insets top="15.0" />