add: change Scenes
This commit is contained in:
		| @@ -26,12 +26,8 @@ public class LoginController { | ||||
|         String email = tfEmail.getText(); | ||||
|         String password = pfPassword.getText(); | ||||
|         if(benutzerMap.containsKey(email) && benutzerMap.containsValue(password)){ | ||||
|             FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.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(); | ||||
|             // if user is worker: StartViewApplication.changeScene("workerMenu-view.fxml"); | ||||
|             StartViewApplication.changeScene("parentMenu-view.fxml"); | ||||
|         }else { | ||||
|             Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch"); | ||||
|             alert.showAndWait(); | ||||
| @@ -42,12 +38,6 @@ public class LoginController { | ||||
|     } | ||||
|     @FXML | ||||
|     protected void changeToSignUp() throws IOException { | ||||
|         FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.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(); | ||||
|  | ||||
|         StartViewApplication.changeScene("signUp-view.fxml"); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -55,8 +55,7 @@ public class ParentMenuController { | ||||
|  | ||||
|     @FXML | ||||
|     public void onAusloggenClick(MouseEvent mouseEvent) throws IOException { | ||||
|         Parent p = FXMLLoader.load(StartViewApplication.class.getResource("workerMenu-view.fxml")); | ||||
|         StartViewApplication.primary.getScene().setRoot(p); | ||||
|         StartViewApplication.changeScene("workerMenu-view.fxml"); | ||||
|     } | ||||
|  | ||||
|     private void changePage(String page) { | ||||
|   | ||||
| @@ -0,0 +1,11 @@ | ||||
| package com.bib.essensbestellungsverwaltung; | ||||
|  | ||||
| import javafx.event.ActionEvent; | ||||
|  | ||||
| public class SingUpController { | ||||
|     public void onKontoErstellenBtClick(ActionEvent actionEvent) { | ||||
|     } | ||||
|  | ||||
|     public void onAnmeldenBtClick(ActionEvent actionEvent) { | ||||
|     } | ||||
| } | ||||
| @@ -7,6 +7,7 @@ package com.bib.essensbestellungsverwaltung; | ||||
|  | ||||
| import javafx.application.Application; | ||||
| import javafx.fxml.FXMLLoader; | ||||
| import javafx.scene.Parent; | ||||
| import javafx.scene.Scene; | ||||
| import javafx.stage.Stage; | ||||
|  | ||||
| @@ -14,10 +15,11 @@ import java.io.IOException; | ||||
|  | ||||
| public class StartViewApplication extends Application { | ||||
|     public static Stage primary; | ||||
|  | ||||
|     @Override | ||||
|     public void start(Stage stage) throws IOException { | ||||
|         FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml")); | ||||
|         Scene scene = new Scene(fxmlLoader.load(), 1200,750); | ||||
|         Scene scene = new Scene(fxmlLoader.load(), 1200, 750); | ||||
|         primary = stage; | ||||
|         stage.setTitle("Essen Bestellung im Kindergarten"); | ||||
|         stage.setScene(scene); | ||||
| @@ -34,4 +36,9 @@ public class StartViewApplication extends Application { | ||||
|         //Database.deleteSample(); | ||||
|         launch(); | ||||
|     } | ||||
|  | ||||
|     public static void changeScene(String scene) throws IOException { | ||||
|         Parent p = FXMLLoader.load(StartViewApplication.class.getResource(scene)); | ||||
|         primary.getScene().setRoot(p); | ||||
|     } | ||||
| } | ||||
| @@ -40,6 +40,7 @@ public class WorkerMenuController { | ||||
|  | ||||
|     @FXML | ||||
|     public void onWochenplanClick(MouseEvent mouseEvent) { | ||||
|         changePage("createFoodplan-view.fxml"); | ||||
|         setButtonActive(wochenplanButton); | ||||
|     } | ||||
|  | ||||
| @@ -59,6 +60,7 @@ public class WorkerMenuController { | ||||
|  | ||||
|     @FXML | ||||
|     public void onMahlzeitClick(MouseEvent mouseEvent) { | ||||
|         changePage("createFood-view.fxml"); | ||||
|         setButtonActive(mahlzeitButton); | ||||
|     } | ||||
|  | ||||
| @@ -69,8 +71,7 @@ public class WorkerMenuController { | ||||
|  | ||||
|     @FXML | ||||
|     public void onAusloggenClick(MouseEvent mouseEvent) throws IOException { | ||||
|         Parent p = FXMLLoader.load(StartViewApplication.class.getResource("parentMenu-view.fxml")); | ||||
|         StartViewApplication.primary.getScene().setRoot(p); | ||||
|         StartViewApplication.changeScene("parentMenu-view.fxml"); | ||||
|     } | ||||
|  | ||||
|     private void changePage(String page) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Johannes Kantz
					Johannes Kantz