Multiple screens and controllers :: extra info on the example code
Originele Kode (JavaFX Meervoudige fxml schermen laden| load multiple fxml schermen. pw)
Belgium:
De eigenschappen die we instelden in onze fxml bestanden zoals VBox.vgrow="ALWAYS" en "AnchorPane.topAnchor" werken niet in het gemaakte voorbeeld. Dit euvel is eenvoudig op te lossen indien je in de volgende kode uit de fxml bestanden :
...
<?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> <?scenebuilder-background-color 0x404040ff?>
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="550.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="meervoudige_schermen.MenuController"> <children>
...
deze code invoegt na bvb prefWidth="600.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
Nadien zal je merken dat alle instellingen die we gemaakt hebben ook werken.
Engish:
The strech properties like VBox.vgrow="ALWAYS" or properties like "AnchorPane.topAnchor" I configured are not working in the project Load multiple screens. Thats correct. To solve this issue you simply have to inset the code below into the start AnchorPane in all the fxml files :
...
<?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> <?scenebuilder-background-color 0x404040ff?>
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="550.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="meervoudige_schermen.MenuController"> <children>
...
Insert for ex. after prefWidth="600.0":
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
and the configuration made in the fxml file will work.
pw [België]
Español:
Las propiedades de estiramiento como VBox.vgrow = "ALWAYS" o propiedades como "AnchorPane.topAnchor" configuré in su projecto FXML no están trabajando (en el projecto cargar múltiples pantallas). Eso es correcto . Para resolver este problema , simplemente tienes que insertar el código siguiente en el inicio AnchorPane inicio en el fxml archivos :
...<?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> <?scenebuilder-background-color 0x404040ff?>
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="550.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="meervoudige_schermen.MenuController"> <children>
...
Inserte (ej. después prefWidth="600.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
y la configuración realizada en el archivo fxml funcionará.
PW [Bélgica ]
|