将另一个视图的锚定窗格加载到视图中

时间:2019-03-26 08:29:31

标签: javafx

我有一个JavaFx应用程序,具有两个视图,每个视图一个控制器。 不,我想在view1的VBbox中多次集成view2的锚定窗格。我不知道如何整合该视图。

我要集成的锚点(outgoingMessageView.fxml)

<AnchorPane fx:id="outgoingMessageAnchor" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.exxeta.mqttng.controller.OutgoingMessageViewController">
    <children>
        <BorderPane blendMode="SRC_OVER" focusTraversable="false" layoutX="486.0" layoutY="53.0" prefHeight="51.0" prefWidth="51.0">
            <center>
                <RadioButton mnemonicParsing="false" text="" />
            </center>
        </BorderPane>
        <BorderPane blendMode="SRC_OVER" cache="true" cacheHint="DEFAULT" focusTraversable="false" layoutX="486.0" layoutY="0.0" prefHeight="51.0" prefWidth="51.0">
            <center>
                <RadioButton mnemonicParsing="false" text="" />
            </center>
        </BorderPane>
        <Label layoutX="14.0" layoutY="11.0" text="/topic" />
        <Label layoutX="14.0" layoutY="30.0" text="/topic" />
        <Label layoutX="14.0" layoutY="48.0" text="550e8400-e29b-11d4-a716-446655440000" />
        <TextField layoutX="14.0" layoutY="78.0" prefHeight="25.0" prefWidth="460.0" text="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;?import java.lang.*?&gt;&lt;?import javafx.scene.*?&gt;&lt;?import javafx.scene.control.*?&gt;&lt;Group id=&quot;sb-clipboard&quot; xmlns:fx=&quot;http://javafx.com/fxml/1&quot; xmlns=&quot;http://javafx.com/javafx/2.2&quot;&gt;  &lt;fx:define&gt;    &lt;Label layoutX=&quot;14.0&quot; layoutY=&quot;66.0&quot; text=&quot;550e8400-e29b-11d4-a716-446655440000&quot; /&gt;  &lt;/fx:define&gt;&lt;/Group&gt;" />
        <Label layoutX="365.0" layoutY="11.0" prefWidth="121.0" text="25-03-2019 15:46:00" />
        <Label layoutX="379.0" layoutY="30.0" prefWidth="51.0" text="Retained" textAlignment="CENTER" />
        <Label layoutX="446.0" layoutY="30.0" prefWidth="32.0" text="QoS2" textAlignment="CENTER" />
        <Label layoutX="381.0" layoutY="51.0" prefWidth="97.0" text="Answer Expected" textAlignment="CENTER" />
        <Separator layoutX="486.0" layoutY="3.0" minWidth="0.0" orientation="VERTICAL" prefHeight="98.0" prefWidth="0.0" />
    </children>
</AnchorPane>

该视图的控制器:(OutgoingMessageViewController.java)

public class OutgoingMessageViewController {

    @FXML
    public AnchorPane outgoingMessageAnchor;

我要在其中集成锚定窗格的第一个视图的控制器:

AnchorPane newLoadedPane = new AnchorPane();
            try {
                newLoadedPane = FXMLLoader.load(getClass().getResource("../../../../../resources/com/exxeta/mqttng/controller/outgoingMessageView.fxml"));

            } catch (IOException ex ){

            }
            outgoingVBox.getChildren().add(newLoadedPane);

0 个答案:

没有答案