Username und Passwort
This commit is contained in:
parent
d1737b730f
commit
31b6b2cc39
@ -11,8 +11,13 @@ public class HelloApplication extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
|
||||
stage.setTitle("Hello World! von Richard");
|
||||
/**
|
||||
* @autor: Reshad Meher
|
||||
* Fenstergrößer
|
||||
* Fenstertitle
|
||||
*/
|
||||
Scene scene = new Scene(fxmlLoader.load(), 480, 280);
|
||||
stage.setTitle("Essen Bestellung im Kindergarten");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
@ -1,14 +1,34 @@
|
||||
package com.bib.essensbestellungsverwaltung;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
public class HelloController {
|
||||
@FXML
|
||||
private Label welcomeText;
|
||||
/**
|
||||
* @autor: Reshad Meher
|
||||
* Username, Passwort , login
|
||||
*/
|
||||
|
||||
@FXML
|
||||
protected void onHelloButtonClick() {
|
||||
welcomeText.setText("Welcome to JavaFX Application!");
|
||||
private TextField unsernameEingabe;
|
||||
@FXML
|
||||
private TextField passwortEingabe;
|
||||
@FXML
|
||||
private Label lblAusgabe;
|
||||
@FXML
|
||||
protected void onLoginButtonClick() {
|
||||
String benutzerEingabe = unsernameEingabe.getText();
|
||||
String kennwortEingabe = passwortEingabe.getText();
|
||||
if(benutzerEingabe.contains("Reshad") && kennwortEingabe.contains("test123")){
|
||||
lblAusgabe.setText("Herzlich Willkommen, " + benutzerEingabe + "!");
|
||||
}else {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR,
|
||||
"Die Benutzername oder Passwort ist falsch");
|
||||
alert.showAndWait();
|
||||
}
|
||||
unsernameEingabe.setText("");
|
||||
passwortEingabe.setText("");
|
||||
}
|
||||
}
|
@ -5,12 +5,28 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.bib.essensbestellungsverwaltung.HelloController">
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.control.PasswordField?>
|
||||
<GridPane hgap="10.0" vgap="10.0"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
xmlns="http://javafx.com/javafx/11.0.2"
|
||||
fx:controller="com.bib.essensbestellungsverwaltung.HelloController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
|
||||
</padding>
|
||||
|
||||
<Label fx:id="welcomeText"/>
|
||||
<Button text="Hello!" onAction="#onHelloButtonClick"/>
|
||||
</VBox>
|
||||
<Label text="Bitte geben Sie Ihre Anmeldedaten ein."
|
||||
GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="0" />
|
||||
<Label text="Benutzername:"
|
||||
GridPane.columnIndex="0" GridPane.rowIndex="1" />
|
||||
<TextField fx:id="unsernameEingabe"
|
||||
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
<Label text="Passwort:"
|
||||
GridPane.columnIndex="0" GridPane.rowIndex="2" />
|
||||
<PasswordField fx:id="passwortEingabe"
|
||||
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||
<Button text="LOGIN" onAction="#onLoginButtonClick"
|
||||
GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||
<Label fx:id="lblAusgabe"
|
||||
GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="4"/>
|
||||
</GridPane>
|
||||
|
Loading…
Reference in New Issue
Block a user