如何在javafx中另一个SplitPane中存在的SplitPane中加载AnchorPane

时间:2014-12-04 23:14:29

标签: java javafx

我创建了一个水平拆分窗格,然后创建了一个垂直窗格。

如何在第二个拆分窗格中加载anchorPane?

2 个答案:

答案 0 :(得分:0)

与在SplitPane中添加任何其他节点的方式相同,或者将第二个SplitPane添加到第一个节点。

verticalOne.getItems().add(anchorPane);

答案 1 :(得分:0)

我的fxml文件:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.paint.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>

<SplitPane dividerPositions="0.1927710843373494" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" orientation="VERTICAL" prefHeight="558.0" prefWidth="1100.0" style="-fx-background-color: white;" stylesheets="@projet/Demo.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
  <items>
    <AnchorPane id="anchor1" disable="true" maxHeight="120.0" maxWidth="1.7976931348623157E308" minHeight="100.0" minWidth="160.0" prefHeight="100.0" prefWidth="160.0">
         <children>
            <ImageView fitHeight="104.0" fitWidth="1100.0" opacity="0.34" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="-2.0" AnchorPane.topAnchor="0.0">
               <image>
                  <Image url="@projet/Sans%20tre.png" />
               </image>
            </ImageView>
            <Label layoutX="919.0" layoutY="8.0" text="RABT LE 04/12/2014" textFill="BLUE">
               <font>
                  <Font name="System Bold" size="18.0" />
               </font>
            </Label>
         </children></AnchorPane>
    <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" style="-fx-background-color: white;" SplitPane.resizableWithParent="false">
         <children>
            <SplitPane dividerPositions="0.17883211678832117" layoutY="-9.0" prefHeight="446.0" prefWidth="1098.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
              <items>
                <AnchorPane id="anchor2" maxWidth="200.0" minHeight="0.0" minWidth="200.0" prefHeight="424.0" prefWidth="180.0">
                     <children>
                        <VBox layoutX="6.0" layoutY="30.0" maxHeight="335.0" maxWidth="175.0" minHeight="315.0" pickOnBounds="false" prefHeight="424.0" prefWidth="152.0" snapToPixel="false" spacing="30.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                           <children>
                              <Button layoutX="34.0" layoutY="47.0" mnemonicParsing="false" prefHeight="101.0" prefWidth="135.0" text="Saisir les données" textAlignment="CENTER">
                                 <VBox.margin>
                                    <Insets left="10.0" />
                                 </VBox.margin>
                              </Button>
                              <Button layoutX="34.0" layoutY="90.0" mnemonicParsing="false" prefHeight="101.0" prefWidth="135.0" text="Consulter les&#10; informations&#10; des intervention " textAlignment="CENTER">
                                 <VBox.margin>
                                    <Insets left="10.0" />
                                 </VBox.margin>
                              </Button>
                              <Button layoutX="20.0" layoutY="122.0" mnemonicParsing="false" prefHeight="101.0" prefWidth="135.0" text="Consulter les&#10;Statistiques" textAlignment="CENTER">
                                 <VBox.margin>
                                    <Insets left="10.0" />
                                 </VBox.margin>
                              </Button>
                           </children>
                        </VBox>
                     </children></AnchorPane>
                <AnchorPane id="anchor3" disable="true" maxWidth="30000.0" minHeight="0.0" minWidth="889.0" prefHeight="444.0" prefWidth="901.0" style="-fx-background-color: white;" />
              </items>
            </SplitPane>
         </children></AnchorPane>
  </items>
</SplitPane>