wechseln zwischen Masken.
This commit is contained in:
parent
3614743795
commit
9b15191da6
@ -1,4 +1,9 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
|
||||||
public class HauptmenueMitarbeiterView {
|
public class HauptmenueMitarbeiterView {
|
||||||
|
public void onAbmelden(ActionEvent actionEvent) {
|
||||||
|
VerwaltungApplication.sceneWechseln("login-view.fxml");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
|
||||||
|
|
||||||
import javafx.application.Application;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class HelloApplication extends Application {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start(Stage stage) throws IOException {
|
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("login-view.fxml"));
|
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 960, 540);
|
|
||||||
stage.setTitle("Hello!");
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
|
|
||||||
public class HelloController {
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label welcomeText;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
protected void onHelloButtonClick() {
|
|
||||||
welcomeText.setText("Welcome to JavaFX Application!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,6 @@
|
|||||||
package de.subway_surfers.vpr_app;
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
|
||||||
public class LoginView {
|
public class LoginView {
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,115 @@
|
|||||||
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class VerwaltungApplication extends Application {
|
||||||
|
|
||||||
|
private static Stage stage;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) throws IOException {
|
||||||
|
FXMLLoader fxmlLoader = new FXMLLoader(VerwaltungApplication.class.getResource("login-view.fxml"));
|
||||||
|
Scene scene = new Scene(fxmlLoader.load());
|
||||||
|
|
||||||
|
stage.setWidth(960);
|
||||||
|
stage.setHeight(540);
|
||||||
|
|
||||||
|
stage.setMinWidth(960);
|
||||||
|
stage.setMinHeight(540);
|
||||||
|
|
||||||
|
stage.setTitle("Hello!");
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
|
||||||
|
VerwaltungApplication.stage = stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Stage getStage() {
|
||||||
|
return stage;
|
||||||
|
}
|
||||||
|
public static void setStage(Stage stage) {
|
||||||
|
VerwaltungApplication.stage = stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Scene auf der aktuellen Stage wird durch die in der fxml-Datei definierte Scene ausgetauscht.
|
||||||
|
*
|
||||||
|
* Geschrieben: Sven Alteköster
|
||||||
|
* Getestet:
|
||||||
|
*
|
||||||
|
* @param fxml name der zu ladenden fxml Datei.
|
||||||
|
*/
|
||||||
|
public static void sceneWechseln(String fxml) {
|
||||||
|
FXMLLoader fxmlLoader = new FXMLLoader(VerwaltungApplication.class.getResource(fxml));
|
||||||
|
|
||||||
|
Stage akt = VerwaltungApplication.getStage();
|
||||||
|
|
||||||
|
double breite = akt.getWidth();
|
||||||
|
double hoehe = akt.getHeight();
|
||||||
|
|
||||||
|
//neue Scene wird auf die Stage gesetzt
|
||||||
|
try {
|
||||||
|
Scene scene = new Scene(fxmlLoader.load());
|
||||||
|
akt.setScene(scene);
|
||||||
|
|
||||||
|
akt.show();
|
||||||
|
|
||||||
|
akt.setWidth(breite);
|
||||||
|
akt.setHeight(hoehe);
|
||||||
|
}
|
||||||
|
//wird die angegebene fxml Datei nicht gefunden, wird ein Alertfenster geöffnet
|
||||||
|
catch (IOException e) {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||||
|
alert.setContentText("Beim Laden der Maske ist ein Fehler aufgetreten");
|
||||||
|
alert.showAndWait();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* in einem neuen Fenster wird die in der fxml-Datei definierte Scene gesetzt.
|
||||||
|
* Die geladene Scene wird <b><u>nicht</u></b> zu der neuen Hauptstage.
|
||||||
|
*
|
||||||
|
* Geschrieben: Sven Alteköster
|
||||||
|
* Getestet:
|
||||||
|
*
|
||||||
|
* @param neue Stage auf der die Scene gesetzt werden soll
|
||||||
|
* @param width breite des neuen Fensters
|
||||||
|
* @param height höhe des neuen Fensters
|
||||||
|
* @param fxml name der fxml Datei
|
||||||
|
*/
|
||||||
|
public static void sceneWechseln(Stage neue, int width, int height, String fxml) {
|
||||||
|
FXMLLoader fxmlLoader = new FXMLLoader(VerwaltungApplication.class.getResource(fxml));
|
||||||
|
|
||||||
|
Stage akt = VerwaltungApplication.getStage();
|
||||||
|
//neue Scene wird auf eine neue Stage gesetzt
|
||||||
|
try {
|
||||||
|
Scene scene = new Scene(fxmlLoader.load(), width, height);
|
||||||
|
neue.setScene(scene);
|
||||||
|
|
||||||
|
neue.show();
|
||||||
|
}
|
||||||
|
//wird die angegebene fxml Datei nicht gefunden, wird ein Alertfenster geöffnet
|
||||||
|
catch (IOException | RuntimeException e) {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||||
|
alert.setContentText("Beim Laden der Maske ist ein Fehler aufgetreten");
|
||||||
|
alert.showAndWait();
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package de.subway_surfers.vpr_app;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
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.Label;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class VerwaltungController {
|
||||||
|
|
||||||
|
public void initialize(){
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wird der Abmeldenbutton geklickt, wird der Nutzer angemeldet.
|
||||||
|
*/
|
||||||
|
public void onAnmeldenClick(ActionEvent actionEvent) {
|
||||||
|
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
<top>
|
<top>
|
||||||
<BorderPane styleClass="kopfzeile">
|
<BorderPane styleClass="kopfzeile">
|
||||||
<right>
|
<right>
|
||||||
<Button text="Abmelden"/>
|
<Button text="Abmelden" onAction="#onAbmelden"/>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
</top>
|
</top>
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
|
|
||||||
fx:controller="de.subway_surfers.vpr_app.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>
|
|
@ -53,11 +53,11 @@
|
|||||||
-fx-padding: 20;
|
-fx-padding: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login_ueberschrift{
|
.ueberschrift {
|
||||||
-fx-margin: 100 0 0 0;
|
|
||||||
-fx-alignment: center;
|
-fx-alignment: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login_ueberschrift .label {
|
.ueberschrift > .label{
|
||||||
-fx-font-size: 30;
|
-fx-font-size: 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,20 +8,20 @@
|
|||||||
|
|
||||||
<BorderPane xmlns="http://javafx.com/javafx"
|
<BorderPane xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
fx:controller="de.subway_surfers.vpr_app.LoginView"
|
fx:controller="de.subway_surfers.vpr_app.VerwaltungController"
|
||||||
prefHeight="400.0" prefWidth="600.0"
|
prefHeight="400.0" prefWidth="600.0"
|
||||||
stylesheets="@layout.css" styleClass="login">
|
stylesheets="@layout.css" styleClass="login aussen">
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<GridPane styleClass="login_eingabe">
|
<GridPane styleClass="login_eingabe">
|
||||||
<HBox GridPane.columnSpan="2" styleClass="login_ueberschrift">
|
<HBox GridPane.columnSpan="2" styleClass="ueberschrift">
|
||||||
<Label text="Anmelden"/>
|
<Label text="Anmelden" styleClass="label"/>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
<Label text="Benutzername" GridPane.rowIndex="1" GridPane.columnIndex="0"/>
|
<Label text="Benutzername" GridPane.rowIndex="1" GridPane.columnIndex="0"/>
|
||||||
<TextField GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
<TextField GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
||||||
<Label text="Passwort" GridPane.rowIndex="2" GridPane.columnIndex="0"/>
|
<Label text="Passwort" GridPane.rowIndex="2" GridPane.columnIndex="0"/>
|
||||||
<TextField GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
<PasswordField GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
||||||
|
|
||||||
<CheckBox text="Kennwort merken" GridPane.rowIndex="3" GridPane.columnIndex="0"/>
|
<CheckBox text="Kennwort merken" GridPane.rowIndex="3" GridPane.columnIndex="0"/>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
<BorderPane>
|
<BorderPane>
|
||||||
<right>
|
<right>
|
||||||
<VBox styleClass="login_btn_anmelden">
|
<VBox styleClass="login_btn_anmelden">
|
||||||
<Button text="Anmelden" />
|
<Button text="Anmelden" onAction="#onAnmeldenClick"/>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|
||||||
</right>
|
</right>
|
||||||
|
Loading…
Reference in New Issue
Block a user