将hbox浮动到父级

时间:2015-06-04 15:01:38

标签: javafx fxml

我有fxml文件,它会在右下方显示弹出窗口。但起初我的fxml大小是500 * 700。如果我将该文件设置为最大值,那么HBox应该从右下角开始,但是现在它正处于初始位置。

如何根据屏幕使HBox浮动?

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


<VBox minHeight="600.0" prefWidth="800.0" stylesheets="@NonRepudiation.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
    <children>
        <!-- <HBox> -->
        <!-- <padding> -->
        <!-- <Insets bottom="5.0" left="5.0" right="5.0" top="20.0" /> -->
        <!-- </padding> -->
        <!-- </HBox> -->
        <HBox>
            <children>

                <TitledPane animated="true" layoutY="34.0" minWidth="-Infinity" prefHeight="580.0" prefWidth="366.0" style="-fx-font-weight: bold;" text="Filter Criteria" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="64.0">
                    <content>
                        <AnchorPane maxWidth="-Infinity" minWidth="-Infinity" prefHeight="580.0" prefWidth="356.0">
                            <children>

                                <TitledPane animated="true" minWidth="-Infinity" style="-fx-font-weight: bold;" styleClass="hiddenHeader" text="Filter Criteria" translateX="-20.0">
                                    <font>
                                        <Font name="Calibri Bold" size="11.0" />
                                    </font>
                                </TitledPane>
                                <VBox prefHeight="580.0" prefWidth="359.0" style="-fx-font-weight: bold;">
                                    <children>
                                        <TitledPane animated="true" prefHeight="145.0" prefWidth="359.0" style="-fx-font-weight: bold;" styleClass="custom-pane" text="Quick Search">
                                            <content>
                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="90.0" prefWidth="357.0">
                                                    <children>
                                                        <VBox layoutX="10.0" layoutY="20.0">
                                                            <children>
                                                                <!--<HBox layoutX="10.0" layoutY="0.0" prefHeight="35.0" 
                                                                    prefWidth="318.0" spacing="8.0" styleClass="vbox-column"> <children> <Label 
                                                                    prefHeight="14.0" prefWidth="94.0" text="Value Date From"> <HBox.margin> 
                                                                    <Insets right="2.0" top="5.0" /> </HBox.margin> </Label> <DatePicker prefWidth="94.0" 
                                                                    /> <Label prefHeight="14.0" prefWidth="20.0" text=" To"> <HBox.margin> <Insets 
                                                                    top="5.0" /> </HBox.margin> </Label> <DatePicker prefWidth="94.0" /> </children> 
                                                                    <padding> <Insets top="10.0" /> </padding> </HBox> -->
                                                                <HBox layoutX="10.0" layoutY="20.0" prefHeight="35.0" prefWidth="345.0" spacing="8.0" styleClass="vbox-column">
                                                                    <children>
                                                                        <Label prefHeight="14.0" prefWidth="91.0" text="Deal Number">
                                                                            <HBox.margin>
                                                                                <Insets right="2.0" top="5.0" />
                                                                            </HBox.margin>
                                                                        </Label>
                                                                        <TextField fx:id="dealNumber" prefWidth="160.0" />
                                                                    </children>
                                                                    <padding>
                                                                        <Insets top="10.0" />
                                                                    </padding>
                                                                </HBox>
                                                                <HBox layoutX="10.0" layoutY="50.0" prefHeight="35.0" prefWidth="345.0" spacing="8.0" styleClass="vbox-column">
                                                                    <children>
                                                                        <Label prefHeight="14.0" prefWidth="91.0" text="Digest Reference">
                                                                            <HBox.margin>
                                                                                <Insets right="2.0" top="5.0" />
                                                                            </HBox.margin>
                                                                        </Label>
                                                                        <TextField fx:id="digestReference" prefWidth="160.0" />
                                                                        <Button maxHeight="-Infinity" minHeight="22.0" mnemonicParsing="false" onAction="#onQuickSearch" styleClass="advancedRedButton" text="Search" />
                                                                    </children>
                                                                    <padding>
                                                                        <Insets top="10.0" />
                                                                    </padding>
                                                                </HBox>
                                                            </children>
                                                        </VBox>
                                                    </children>
                                                </AnchorPane>
                                            </content>
                                        </TitledPane>
                                        <TitledPane animated="true" prefHeight="430.0" prefWidth="359.0" style="-fx-border-width: 1 1 0 1;" styleClass="custom-pane" text="Advanced Search">

                                            <content>
                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="580.0" prefWidth="357.0">
                                                    <children>
                                                        <HBox layoutX="7.0" layoutY="1.0" prefHeight="336.0" prefWidth="341.0">
                                                            <children>
                                                                <GridPane hgap="3.0" layoutX="6.6" layoutY="40.0" prefHeight="223.0" prefWidth="341.0" vgap="1.0" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="-3.0" AnchorPane.rightAnchor="-10.0" AnchorPane.topAnchor="51.0">
                                                                    <columnConstraints>
                                                                        <ColumnConstraints hgrow="SOMETIMES" maxWidth="132.99999237060547" minWidth="10.0" prefWidth="122.0" />
                                                                        <ColumnConstraints hgrow="SOMETIMES" maxWidth="101.0" minWidth="10.0" prefWidth="92.0" />
                                                                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                                    </columnConstraints>
                                                                    <rowConstraints>
                                                                        <RowConstraints maxHeight="43.0" minHeight="7.0" prefHeight="22.0" vgrow="SOMETIMES" />
                                                                        <RowConstraints maxHeight="88.0" minHeight="10.0" prefHeight="28.0" vgrow="SOMETIMES" />
                                                                        <RowConstraints maxHeight="107.0" minHeight="10.0" prefHeight="29.0" vgrow="SOMETIMES" />
                                                                        <RowConstraints maxHeight="119.0" minHeight="10.0" prefHeight="29.0" vgrow="SOMETIMES" />
                                                                        <RowConstraints maxHeight="133.0" minHeight="0.0" prefHeight="20.0" vgrow="SOMETIMES" />
                                                                        <RowConstraints maxHeight="138.0" minHeight="0.0" prefHeight="79.0" vgrow="SOMETIMES" />
                                                                    </rowConstraints>
                                                                    <children>
                                                                        <Text strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-weight: bold; -fx-font-size: 14px;" text="Field" textAlignment="CENTER" wrappingWidth="35.9765625" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
                                                                        </Text>
                                                                        <Text strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-weight: bold; -fx-font-size: 14px;" text="Operator" GridPane.columnIndex="1" GridPane.halignment="CENTER">
                                                                        </Text>
                                                                        <Text strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-weight: bold; -fx-font-size: 14px;" text="Value" GridPane.columnIndex="2" GridPane.halignment="CENTER">
                                                                        </Text>
                                                                        <ComboBox fx:id="advOperator1" prefWidth="150.0" promptText="Select Operator" GridPane.columnIndex="1" GridPane.rowIndex="1">
                                                                            <items>
                                                                                <FXCollections fx:factory="observableArrayList">
                                                                                    <String fx:value="IN" />
                                                                                    <String fx:value="NOT IN" />
                                                                                    <String fx:value="EQUALS" />
                                                                                    <String fx:value="NOT EQUALS" />
                                                                                    <String fx:value="LESS THAN" />
                                                                                    <String fx:value="LESS THAN EQUALS" />
                                                                                    <String fx:value="GREATER THAN" />
                                                                                    <String fx:value="GREATER THAN EQUALS" />
                                                                                </FXCollections>
                                                                            </items>
                                                                        </ComboBox>
                                                                        <ComboBox fx:id="advOperator2" prefWidth="150.0" promptText="Select Operator" GridPane.columnIndex="1" GridPane.rowIndex="2">
                                                                            <items>
                                                                                <FXCollections fx:factory="observableArrayList">
                                                                                    <String fx:value="IN" />
                                                                                    <String fx:value="NOT IN" />
                                                                                    <String fx:value="EQUALS" />
                                                                                    <String fx:value="NOT EQUALS" />
                                                                                    <String fx:value="LESS THAN" />
                                                                                    <String fx:value="LESS THAN EQUALS" />
                                                                                    <String fx:value="GREATER THAN" />
                                                                                    <String fx:value="GREATER THAN EQUALS" />
                                                                                </FXCollections>
                                                                            </items>
                                                                        </ComboBox>
                                                                        <ComboBox fx:id="advOperator3" prefWidth="150.0" promptText="Select Operator" GridPane.columnIndex="1" GridPane.rowIndex="3">
                                                                            <items>
                                                                                <FXCollections fx:factory="observableArrayList">
                                                                                    <String fx:value="IN" />
                                                                                    <String fx:value="NOT IN" />
                                                                                    <String fx:value="EQUALS" />
                                                                                    <String fx:value="NOT EQUALS" />
                                                                                    <String fx:value="LESS THAN" />
                                                                                    <String fx:value="LESS THAN EQUALS" />
                                                                                    <String fx:value="GREATER THAN" />
                                                                                    <String fx:value="GREATER THAN EQUALS" />
                                                                                </FXCollections>
                                                                            </items>
                                                                        </ComboBox>
                                                                        <!-- <ComboBox prefWidth="150.0" promptText="Message Type" 
                                                                            GridPane.rowIndex="5" /> <ComboBox prefWidth="150.0" promptText="Equals" 
                                                                            GridPane.columnIndex="1" GridPane.rowIndex="5" /> <ComboBox prefWidth="150.0" 
                                                                            promptText="CCY" GridPane.rowIndex="6" /> <ComboBox prefWidth="150.0" promptText="IN" 
                                                                            GridPane.columnIndex="1" GridPane.rowIndex="6" /> -->
                                                                        <TextField GridPane.columnIndex="2" GridPane.rowIndex="1" />
                                                                        <TextField GridPane.columnIndex="2" GridPane.rowIndex="2" />
                                                                        <TextField fx:id="advText1" GridPane.columnIndex="2" GridPane.rowIndex="1" />
                                                                        <TextField fx:id="advText2" GridPane.columnIndex="2" GridPane.rowIndex="2" />
                                                                        <TextField fx:id="advText3" GridPane.columnIndex="2" GridPane.rowIndex="3" />
                                                      <Label text="Select Field" GridPane.rowIndex="1">
                                                         <GridPane.margin>
                                                            <Insets left="5.0" />
                                                         </GridPane.margin>
                                                      </Label>
                                                      <Label text="Select Field" GridPane.rowIndex="2">
                                                         <GridPane.margin>
                                                            <Insets left="5.0" />
                                                         </GridPane.margin>
                                                      </Label>
                                                      <Label text="Select Field" GridPane.rowIndex="3">
                                                         <padding>
                                                            <Insets left="5.0" />
                                                         </padding>
                                                      </Label>
                                                      <Label text="Update Date" GridPane.rowIndex="4">
                                                         <padding>
                                                            <Insets left="5.0" />
                                                         </padding>
                                                      </Label>
                                                                        <!-- <TextField GridPane.columnIndex="2" GridPane.rowIndex="4" 
                                                                            /> <TextField GridPane.columnIndex="2" GridPane.rowIndex="6" /> -->
                                                                    </children>
                                                                </GridPane>
                                                            </children>
                                                        </HBox>
                                                        <HBox layoutX="7.0" layoutY="245.0" prefHeight="35.0" prefWidth="348.0">
                                                            <children>
                                                                <Text layoutX="7.0" layoutY="250.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Template Name">
                                                                    <HBox.margin>
                                                                        <Insets right="5.0" top="9.0" />
                                                                    </HBox.margin>
                                                                </Text>
                                                                <ComboBox layoutX="94.0" layoutY="319.0" prefWidth="248.0" promptText="Default Template">
                                                                    <items>
                                                                        <FXCollections fx:factory="observableArrayList">
                                                                            <String fx:value="Private" />
                                                                            <String fx:value="Public" />                                                                                    
                                                                        </FXCollections>
                                                                    </items>
                                                                    <HBox.margin>
                                                                        <Insets left="7.0" />
                                                                    </HBox.margin>
                                                                </ComboBox>
                                                            </children>
                                                        </HBox>

                                                        <HBox layoutX="7.0" layoutY="285.0" prefHeight="35.0" prefWidth="348.0">
                                                            <children>
                                                                <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Type of template">
                                                                    <HBox.margin>
                                                                        <Insets top="9.0" />
                                                                    </HBox.margin>
                                                                </Text>
                                                                <ComboBox prefWidth="248.0" promptText="Public">
                                                                    <HBox.margin>
                                                                        <Insets left="5.0" />
                                                                    </HBox.margin>
                                                                </ComboBox>
                                                            </children>
                                                        </HBox>
                                                        <HBox layoutX="5.0" layoutY="325.0" prefHeight="45.0" prefWidth="352.0">
                                                            <children>
                                                                <Button mnemonicParsing="false" prefHeight="45.0" prefWidth="67.0" styleClass="advancedRedButton" text="Save Template" textAlignment="CENTER" wrapText="true" />
                                                                <Button mnemonicParsing="false" prefHeight="45.0" prefWidth="67.0" styleClass="advancedRedButton" text="Edit Template" textAlignment="CENTER" wrapText="true">
                                                                    <HBox.margin>
                                                                        <Insets left="8.0" />
                                                                    </HBox.margin>
                                                                </Button>
                                                                <Button mnemonicParsing="false" prefHeight="45.0" prefWidth="67.0" styleClass="advancedRedButton" text="Delete Template" textAlignment="CENTER" wrapText="true">
                                                                    <HBox.margin>
                                                                        <Insets left="8.0" />
                                                                    </HBox.margin>
                                                                </Button>
                                                                <Button mnemonicParsing="false" prefHeight="45.0" prefWidth="55.0" styleClass="advancedRedButton" text="Clear" textAlignment="CENTER" wrapText="true">
                                                                    <HBox.margin>
                                                                        <Insets left="8.0" />
                                                                    </HBox.margin>
                                                                </Button>
                                                                <Button mnemonicParsing="false" onAction="#onAdvancedSearch" prefHeight="45.0" prefWidth="55.0" styleClass="advancedRedButton" text="Search">
                                                                    <HBox.margin>
                                                                        <Insets left="8.0" />
                                                                    </HBox.margin>
                                                                </Button>
                                                            </children>
                                                        </HBox>
                                                        <HBox layoutX="140.0" layoutY="206.0" prefHeight="22.0" prefWidth="251.0">
                                                            <children>
                                                                <DatePicker layoutX="28.0" layoutY="230.0" prefWidth="92.0">
                                                                    <HBox.margin>
                                                                        <Insets right="5.0" />
                                                                    </HBox.margin>
                                                                </DatePicker>
                                                                <Text layoutX="131.0" layoutY="247.0" strokeType="OUTSIDE" strokeWidth="0.0" text="To">
                                                                    <HBox.margin>
                                                                        <Insets right="5.0" top="5.0" />
                                                                    </HBox.margin>
                                                                </Text>
                                                                <DatePicker layoutX="173.0" layoutY="232.0" prefWidth="92.0" />
                                                            </children>
                                                        </HBox>
                                                    </children>
                                                </AnchorPane>
                                            </content>
                                        </TitledPane>
                                    </children>
                                </VBox>

                            </children>
                        </AnchorPane>
                    </content>
                    <graphic>
                        <Label layoutX="-20.0" styleClass="triggerLink" text="Filter Criteria" />
                    </graphic>
                    <styleClass>
                        <String fx:value="arrowPane" />
                        <String fx:value="greyBorder" />
                    </styleClass>
                </TitledPane>
                <AnchorPane minHeight="500.0" minWidth="434.0" HBox.hgrow="ALWAYS">
                    <children>
                        <HBox fillHeight="true" minHeight="500.0" minWidth="434.0" styleClass="greyBorder" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" HBox.hgrow="ALWAYS">
                            <children>


                                        <TableView fx:id="tableView" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS">
                                            <columns>
                                                <TableColumn style="-fx-font-family: Calibri; -fx-font-size: 11px;" text="MessageId">
                                                    <cellValueFactory>
                                                        <PropertyValueFactory property="messageId" />
                                                    </cellValueFactory>
                                                </TableColumn>


                                                <TableColumn prefWidth="110.0" style="-fx-font-family: Calibri; -fx-font-size: 11px;" text="Digest Reference">
                                                    <cellValueFactory>
                                                        <PropertyValueFactory property="digestReference" />
                                                    </cellValueFactory>
                                                </TableColumn>

                                                <TableColumn prefWidth="115.0" style="-fx-font-family: Calibri; -fx-font-size: 11px;" text="Message Reference">
                                                    <cellValueFactory>
                                                        <PropertyValueFactory property="messageRef" />
                                                    </cellValueFactory>
                                                </TableColumn>

                                                <TableColumn prefWidth="115.0" style="-fx-font-family: Calibri; -fx-font-size: 11px;" text="Deal Number">
                                                    <cellValueFactory>
                                                        <PropertyValueFactory property="dealNo" />
                                                    </cellValueFactory>
                                                </TableColumn>


                                                <TableColumn style="-fx-font-family: Calibri; -fx-font-size: 11px;" text="Digest Value">
                                                    <cellValueFactory>
                                                        <PropertyValueFactory property="digestValue" />
                                                    </cellValueFactory>
                                                </TableColumn>


                                                <TableColumn prefWidth="100.0" style="-fx-font-family: Calibri; -fx-font-size: 11px;" text="Updated Date Time">
                                                    <cellValueFactory>
                                                        <PropertyValueFactory property="updateTime" />
                                                    </cellValueFactory>
                                                </TableColumn>

                                            </columns>
                                        </TableView>


                            </children>
                        </HBox>
                        <HBox fx:id="columnConfigHbox" fillHeight="false" layoutX="310.0" layoutY="427.0">
                            <children>
                                <TableView fx:id="columnConfigTable" prefHeight="150.0" prefWidth="110.0" styleClass="noBorderRight" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS">
                                    <columns>
                                        <TableColumn editable="false" minWidth="80.0" prefWidth="90.0" sortable="false" style="-fx-font-family: Calibri; -fx-font-size: 11px;" text="Column Config">
                                            <cellValueFactory>
                                                <PropertyValueFactory property="columnConfig" />
                                            </cellValueFactory>
                                        </TableColumn>
                                    </columns>
                                   <columnResizePolicy>
                                      <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
                                   </columnResizePolicy>
                                </TableView>
                                <Button minHeight="15.0" minWidth="15.0" mnemonicParsing="false" onAction="#closeThis" styleClass="closeThis" />
                            </children> 
                        </HBox>
                  <!-- <GridPane fx:id="columnConfig" layoutX="320.0" layoutY="480.0" visible="false">
                    <columnConstraints>
                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                    </columnConstraints>
                    <rowConstraints>
                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                    </rowConstraints>
                     <children>
                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="CCY" />
                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="CCY Amount" GridPane.rowIndex="1" />
                        <Text strokeType="OUTSIDE" strokeWidth="0.0" text="CTR CCY" GridPane.rowIndex="2" />
                     </children>
                  </GridPane> -->
                    </children>
                </AnchorPane>
            </children>
        </HBox>
    </children>
    <styleClass>
        <!-- <String fx:value="Sapphire" /> -->
        <String fx:value="defaultFont" />
    </styleClass>
</VBox>

0 个答案:

没有答案