diff options
Diffstat (limited to 'src/de/fhswf/in/inf/java2/aufgabe05/MainApplication.java')
| -rw-r--r-- | src/de/fhswf/in/inf/java2/aufgabe05/MainApplication.java | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/de/fhswf/in/inf/java2/aufgabe05/MainApplication.java b/src/de/fhswf/in/inf/java2/aufgabe05/MainApplication.java new file mode 100644 index 0000000..7978cb1 --- /dev/null +++ b/src/de/fhswf/in/inf/java2/aufgabe05/MainApplication.java @@ -0,0 +1,82 @@ +package de.fhswf.in.inf.java2.aufgabe05; + +import java.io.IOException; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.control.SplitPane; +import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.BorderPane; +import javafx.stage.Stage; + +public class MainApplication extends Application +{ + + private Stage primaryStage; + private BorderPane rootLayout; + + @Override + public void start(Stage primaryStage) + { + this.primaryStage = primaryStage; + this.primaryStage.setTitle("ThemeChooser"); + + initRootLayout(); + + showDirectoryOverview(); + } + + private void initRootLayout() + { + try + { + // Load root layout from fxml file. + FXMLLoader loader = new FXMLLoader(); + loader.setLocation(MainApplication.class.getResource("view/RootLayout.fxml")); + rootLayout = (BorderPane) loader.load(); + + // Show the scene containing the root layout. + Scene scene = new Scene(rootLayout); + primaryStage.setScene(scene); + + // Give the controller access to the main app. + // RootLayoutController controller = loader.getController(); + // controller.setMainApp(this); + + primaryStage.show(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + private void showDirectoryOverview() + { + try + { + // Load person overview. + FXMLLoader loader = new FXMLLoader(); + loader.setLocation(MainApplication.class + .getResource("view/DirectoryOverview.fxml")); + AnchorPane personOverview = (AnchorPane) loader.load(); + + // Set person overview into the center of root layout. + rootLayout.setCenter(personOverview); + + // Give the controller access to the main app. + // DirectoryOverviewController controller = loader.getController(); + // controller.setMainApp(this); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + public static void main(String[] args) + { + launch(args); + } +} |
