Browse Source

added a sample nested controller

pull/12/head
Jannik 2 years ago
parent
commit
f23e6c77ea
Signed by: Seil0 GPG Key ID: E8459F3723C52C24
5 changed files with 36 additions and 0 deletions
  1. +18
    -0
      src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java
  2. +1
    -0
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  3. +4
    -0
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  4. +10
    -0
      src/main/resources/fxml/FilmDetailView.fxml
  5. +3
    -0
      src/main/resources/fxml/MainWindow.fxml

+ 18
- 0
src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java View File

@ -0,0 +1,18 @@
package kellerkinder.HomeFlix.application;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
public class FilmDetailView {
@FXML private Label lblFilm;
public void initialize() {
System.out.println("init nested controller");
}
public void foo() {
System.out.println("test");
}
}

+ 1
- 0
src/main/java/kellerkinder/HomeFlix/application/Main.java View File

@ -34,6 +34,7 @@ import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;


+ 4
- 0
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java View File

@ -163,6 +163,9 @@ public class MainWindowController {
// poster-mode
@FXML private ScrollPane posterModeScrollPane;
@FXML private FlowPane posterModeFlowPane;
// FilmDetailView
@FXML private FilmDetailView filmDetailViewController;
private DBController dbController;
private UpdateController updateController;
@ -498,6 +501,7 @@ public class MainWindowController {
@FXML
private void returnBtnclicked() {
filmsTreeTable.getSelectionModel().select(last);
filmDetailViewController.foo();
}
@FXML


+ 10
- 0
src/main/resources/fxml/FilmDetailView.fxml View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane prefHeight="568.0" prefWidth="980.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kellerkinder.HomeFlix.application.FilmDetailView">
<children>
<Label fx:id="lblFilm" layoutX="461.0" layoutY="277.0" text="Test Pane" />
</children>
</AnchorPane>

+ 3
- 0
src/main/resources/fxml/MainWindow.fxml View File

@ -74,6 +74,9 @@
</FlowPane>
</content>
</ScrollPane>
<AnchorPane>
<fx:include source="/fxml/FilmDetailView.fxml" fx:id="filmDetailView" />
</AnchorPane>
<ScrollPane fx:id="settingsScrollPane" fitToHeight="true" fitToWidth="true" prefHeight="568.0" prefWidth="800.0" style="-fx-background: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<content>
<AnchorPane fx:id="settingsAnchorPane" style="-fx-background-color: white;">


Loading…
Cancel
Save