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; package com.bib.essensbestellungsverwaltung;
import javafx.application.Application; import javafx.application.Application;
@ -8,18 +13,17 @@ import javafx.stage.Stage;
import java.io.IOException; import java.io.IOException;
public class HelloApplication extends Application { public class HelloApplication extends Application {
public static Stage primary;
@Override @Override
public void start(Stage stage) throws IOException { public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("login-view.fxml"));
/** Scene scene = new Scene(fxmlLoader.load(), 950,480);
* @autor: Reshad Meher //stage = primary;
* Fenstergrößer
* Fenstertitle
*/
Scene scene = new Scene(fxmlLoader.load(), 480, 280);
stage.setTitle("Essen Bestellung im Kindergarten"); stage.setTitle("Essen Bestellung im Kindergarten");
stage.setScene(scene); stage.setScene(scene);
stage.show(); stage.show();
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -3,9 +3,17 @@ package com.bib.essensbestellungsverwaltung;
import javafx.beans.NamedArg; import javafx.beans.NamedArg;
import javafx.fxml.FXML; 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.Button;
import javafx.scene.control.PasswordField; import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.HashMap;
public class LoginController { public class LoginController {
@FXML @FXML
private TextField tfEmail; private TextField tfEmail;
@ -13,26 +21,35 @@ public class LoginController {
@FXML @FXML
private PasswordField pfPassword; private PasswordField pfPassword;
HashMap<String,String> benutzerMap = new HashMap<String,String>();
@FXML @FXML
private Button btLogin; protected void onBtLoginClick() throws IOException {
benutzerMap.put("Reshad","1234");
@FXML
private Button btSignUp;
@FXML
protected void onBtLoginClick(){
String email = tfEmail.getText(); String email = tfEmail.getText();
String password = pfPassword.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(""); tfEmail.setText("");
pfPassword.setText(""); pfPassword.setText("");
} }
@FXML @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" /> <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;"> <VBox alignment="CENTER" layoutX="263.0" prefHeight="400.0" prefWidth="338.0" style="-fx-background-color: white;">
<children> <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> <VBox.margin>
<Insets bottom="15.0" left="25.0" right="25.0" top="25.0" /> <Insets bottom="15.0" left="25.0" right="25.0" top="25.0" />
</VBox.margin> </VBox.margin>
@ -42,7 +42,7 @@
<Font name="Microsoft Tai Le" size="12.0" /> <Font name="Microsoft Tai Le" size="12.0" />
</font> </font>
</TextField> </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> <VBox.margin>
<Insets bottom="25.0" left="25.0" right="25.0" top="15.0" /> <Insets bottom="25.0" left="25.0" right="25.0" top="15.0" />
</VBox.margin> </VBox.margin>
@ -52,11 +52,11 @@
</PasswordField> </PasswordField>
<HBox alignment="CENTER" prefHeight="30.0" prefWidth="238.0"> <HBox alignment="CENTER" prefHeight="30.0" prefWidth="238.0">
<children> <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>
<Font name="Microsoft Tai Le Bold" size="12.0" /> <Font name="Microsoft Tai Le Bold" size="12.0" />
</font></Button> </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> </children>
</HBox> </HBox>
</children> </children>

View File

@ -12,7 +12,7 @@
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?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> <children>
<VBox alignment="CENTER" prefHeight="400.0" prefWidth="265.0" style="-fx-background-color: lightblue;"> <VBox alignment="CENTER" prefHeight="400.0" prefWidth="265.0" style="-fx-background-color: lightblue;">
<children> <children>
@ -31,7 +31,7 @@
<Circle fill="#93c4f23d" layoutY="258.0" radius="106.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" /> <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;"> <VBox alignment="CENTER" layoutX="263.0" prefHeight="400.0" prefWidth="338.0" style="-fx-background-color: white;">
<children> <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> <effect>
<Blend /> <Blend />
</effect> </effect>
@ -42,7 +42,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin> </VBox.margin>
</TextField> </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> <effect>
<Blend /> <Blend />
</effect> </effect>
@ -53,7 +53,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin> </VBox.margin>
</TextField> </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>
<Font name="Microsoft Tai Le Bold" size="12.0" /> <Font name="Microsoft Tai Le Bold" size="12.0" />
</font> </font>
@ -67,7 +67,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin> </VBox.margin>
</PasswordField> </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>
<Font name="Microsoft Tai Le Bold" size="12.0" /> <Font name="Microsoft Tai Le Bold" size="12.0" />
</font> </font>
@ -83,11 +83,11 @@
</PasswordField> </PasswordField>
<HBox alignment="CENTER" prefHeight="30.0" prefWidth="238.0"> <HBox alignment="CENTER" prefHeight="30.0" prefWidth="238.0">
<children> <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>
<Font name="Microsoft Tai Le Bold" size="12.0" /> <Font name="Microsoft Tai Le Bold" size="12.0" />
</font></Button> </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> </children>
<opaqueInsets> <opaqueInsets>
<Insets top="15.0" /> <Insets top="15.0" />