Browse Source

added a sample nested controller

pull/12/head
Jannik 3 years ago
parent
commit
f23e6c77ea
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 18
      src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java
  2. 1
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  3. 4
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  4. 10
      src/main/resources/fxml/FilmDetailView.fxml
  5. 3
      src/main/resources/fxml/MainWindow.fxml

18
src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java

@ -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
src/main/java/kellerkinder/HomeFlix/application/Main.java

@ -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
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

@ -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
src/main/resources/fxml/FilmDetailView.fxml

@ -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
src/main/resources/fxml/MainWindow.fxml

@ -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

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close