我創建了一個水平分割窗格,然後創建了一個垂直分割窗格。如何在存在於javafx的另一個SplitPane中的SplitPane中加載AnchorPane
如何在第二個拆分窗格中加載anchorPane?
我創建了一個水平分割窗格,然後創建了一個垂直分割窗格。如何在存在於javafx的另一個SplitPane中的SplitPane中加載AnchorPane
如何在第二個拆分窗格中加載anchorPane?
與在SplitPane中添加任何其他節點的方法相同,或者將第二個SplitPane添加到第一個SplitPane中。
verticalOne.getItems().add(anchorPane);
我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 informations 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 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>
當你在你的java類中加載這個fxml時,將id改爲fx:id,你會得到這些節點:@FXML AnchorPane anchor2; – Tobi 2014-12-04 23:56:15
?我怎樣才能在垂直之一。 – eniniz 2014-12-04 23:36:00
你是如何創建它的? – Tobi 2014-12-04 23:36:41
我怎樣才能得到垂直的? (當我創建水平時,我在第二個中獲得了2個AnchorPane,我創建了第二個SplitPane) – eniniz 2014-12-04 23:37:34