当前位置: 首页 > 知识库问答 >
问题:

无法与JavaFX控件交互-可能存在.fxml布局问题

安轶
2023-03-14

我曾经有一个RootLayout边框窗格,它有一个fx:includes锚点窗格,上面有我的控制器。我正试图将这两个文件合并到一个.fxml文件中,但在与应用程序的上半部分交互时遇到了问题(按钮、组合框等不可点击)。我假设我的组织出了问题,甚至可能是错误的高度,但我没有看到它,这是我的第一个javaFX应用程序。如果我在JavaFX Scene Builder中打开.fxml,我只能看到层次结构中的边框窗格。

下面是带有两个.fxml文件的旧设置

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

<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.BorderPane?>

<BorderPane prefHeight="500.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
   <children>
    <fx:include fx:id="Tabs" source="Tabs.fxml" />
   </children>
</BorderPane>
<?xml version="1.0" encoding="UTF-8"?>

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

<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="asset.view.TabsController">
    <children>
        <AnchorPane prefHeight="125.0" prefWidth="500.0" AnchorPane.bottomAnchor="375.0">
            <children>
                <GridPane AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="35.0">
                    <columnConstraints>
                        <ColumnConstraints hgrow="SOMETIMES" maxWidth="95.0" minWidth="10.0" prefWidth="74.0" />
                        <ColumnConstraints hgrow="SOMETIMES" maxWidth="125.0" minWidth="125.0" prefWidth="125.0" />
                        <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>
                    <children>
                        <Button mnemonicParsing="false" onAction="#handleInputRecord" text="Submit" GridPane.columnIndex="2">
                            <GridPane.margin>
                                <Insets left="5.0" />
                            </GridPane.margin>
                        </Button>
                        <Label text="Employee ID" />
                        <Label text="Asset ID" GridPane.rowIndex="1" />
                        <ComboBox fx:id="inputEmployeeIdField" minWidth="125.0" GridPane.columnIndex="1" />
                        <ComboBox fx:id="inputAssetIdField" minWidth="125.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                    </children>
                </GridPane>
            </children>
        </AnchorPane>
        <MenuBar prefWidth="500.0" BorderPane.alignment="CENTER">
            <menus>
                <Menu mnemonicParsing="false" text="File">
                    <items>
                        <MenuItem mnemonicParsing="false" text="Close" />
                    </items>
                </Menu>
                <Menu mnemonicParsing="false" text="Help">
                    <items>
                        <MenuItem mnemonicParsing="false" text="About" />
                    </items>
                </Menu>
            </menus>
        </MenuBar>    
        <AnchorPane prefHeight="375.0" prefWidth="500.0" AnchorPane.topAnchor="125.0">
            <children>
                <TabPane nodeOrientation="LEFT_TO_RIGHT" prefHeight="375.0" prefWidth="500.0" tabClosingPolicy="UNAVAILABLE">
                    <tabs>    
                        <Tab text="Overview">
                            <content>
                                <SplitPane dividerPositions="0.5761872909698996" focusTraversable="true">
                                    <items>
                                        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
                                            <children>
                                                <TableView fx:id="overviewTable" layoutX="-12.5" layoutY="58.0" prefHeight="320.0" prefWidth="175.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                                    <columns>

                                                        <TableColumn fx:id="overviewAssetIdColumn" minWidth="60.0" text="Asset ID" />
                                                        <TableColumn fx:id="overviewEmployeeIdColumn" minWidth="70.0" text="Employee ID" />
                                                        <TableColumn fx:id="overviewAssetNameColumn" minWidth="80.0" text="Asset Name" />
                                                        <TableColumn fx:id="overviewInventoryStatusColumn" minWidth="50.0" text="Status" />
                                                    </columns>
                                                    <columnResizePolicy>
                                                        <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
                                                    </columnResizePolicy>
                                                </TableView>
                                            </children>
                                        </AnchorPane>
                                        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="298.0" prefWidth="400.0">
                                            <children>
                                                <Label layoutX="7.0" layoutY="6.0" text="Overview Details:" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
                                                <GridPane layoutX="14.0" layoutY="33.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0">
                                                    <columnConstraints>
                                                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                        <ColumnConstraints />
                                                        <ColumnConstraints />
                                                        <ColumnConstraints />
                                                        <ColumnConstraints />
                                                        <ColumnConstraints />
                                                        <ColumnConstraints />
                                                    </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 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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                                        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                                    </rowConstraints>
                                                    <children>
                                                        <Label text="Asset ID" />
                                                        <Label text="Asset Name" GridPane.rowIndex="1" />
                                                        <Label text="Manufacturer" GridPane.rowIndex="2" />
                                                        <Label text="Equipment Type" GridPane.rowIndex="3" />
                                                        <Label text="Employee ID" GridPane.rowIndex="4" />
                                                        <Label text="Employee Name" GridPane.rowIndex="5" />
                                                        <Label text="Check Out Date" GridPane.rowIndex="6" />
                                                        <Label fx:id="overviewAssetIdLabel" text="Label" GridPane.columnIndex="1" />
                                                        <Label fx:id="overviewAssetNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                                                        <Label fx:id="overviewManufacturerLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="2" />
                                                        <Label fx:id="overviewTypeLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" />
                                                        <Label fx:id="overviewEmployeeIdLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="4" />
                                                        <Label fx:id="overviewEmployeeNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="5" />
                                                        <Label fx:id="overviewCheckOutDateLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="6" />
                                                        <Label fx:id="overviewIdLabel" text="" GridPane.columnIndex="7" />
                                                    </children>
                                                </GridPane>
                                                <HBox layoutX="215.0" layoutY="259.0" spacing="5.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0">
                                                    <children>
                                                        <Button mnemonicParsing="false" onAction="#handleOverviewRefresh" text="Refresh" />
                                                    </children>
                                                </HBox>

                                            </children>
                                        </AnchorPane>
                                    </items>
                                </SplitPane>
                            </content>
                        </Tab>

                        <Tab text="Employees">
                            <content>
                                <SplitPane dividerPositions="0.42618729096989966" focusTraversable="true">
                                    <items>
                                        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
                                            <children>
                                                <TableView fx:id="employeeTable" layoutX="-12.5" layoutY="58.0" prefHeight="298.0" prefWidth="175.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                                    <columns>
                                                        <TableColumn fx:id="employeeFirstNameColumn" minWidth="102.0" text="First Name" />
                                                        <TableColumn fx:id="employeeLastNameColumn" minWidth="114.0" text="Last Name" />
                                                    </columns>
                                                    <columnResizePolicy>
                                                        <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
                                                    </columnResizePolicy>
                                                </TableView>
                                            </children>
                                        </AnchorPane>
                                        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="298.0" prefWidth="393.0">
                                            <children>
                                                <Label layoutX="7.0" layoutY="6.0" text="Employee Details:" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
                                                <GridPane layoutX="14.0" layoutY="33.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0">
                                                    <columnConstraints>
                                                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                        <ColumnConstraints />
                                                        <ColumnConstraints />
                                                        <ColumnConstraints />
                                                    </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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                                    </rowConstraints>
                                                    <children>
                                                        <Label text="Employee ID" />
                                                        <Label text="First Name" GridPane.rowIndex="1" />
                                                        <Label text="Last Name" GridPane.rowIndex="2" />
                                                        <Label text="Status" GridPane.rowIndex="3" />
                                                        <Label fx:id="employeeEmployeeIdLabel" text="Label" GridPane.columnIndex="1" />
                                                        <Label fx:id="employeeFirstNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                                                        <Label fx:id="employeeLastNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="2" />
                                                        <Label fx:id="employeeStatusLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" />
                                                        <Label fx:id="employeeIdLabel" text="" GridPane.columnIndex="4" />
                                                    </children>
                                                </GridPane>
                                                <HBox layoutX="215.0" layoutY="259.0" spacing="5.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0">
                                                    <children>
                                                        <Button mnemonicParsing="false" onAction="#handleNewEmployee" text="New..." />
                                                        <Button mnemonicParsing="false" onAction="#handleEditEmployee" text="Edit..." />
                                                        <Button mnemonicParsing="false" onAction="#handleDeleteEmployee" text="Delete" />
                                                    </children>
                                                </HBox>
                                            </children>
                                        </AnchorPane>
                                    </items>
                                </SplitPane>
                            </content>
                        </Tab>    
                    </tabs>
                </TabPane>
            </children>
        </AnchorPane>
    </children>
</AnchorPane>
<?xml version="1.0" encoding="UTF-8"?>

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

<BorderPane prefHeight="500.0" prefWidth="500.0"  xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="asset.view.TabsController">
    <children>
        <AnchorPane prefHeight="125.0" prefWidth="500.0" AnchorPane.bottomAnchor="375.0">           
            <children>

        <MenuBar prefWidth="500.0" BorderPane.alignment="CENTER">
            <menus>
                <Menu mnemonicParsing="false" text="File">
                    <items>
                        <MenuItem mnemonicParsing="false" text="Close" />
                    </items>
                </Menu>
                <Menu mnemonicParsing="false" text="Help">
                    <items>
                        <MenuItem mnemonicParsing="false" text="About" />
                    </items>
                </Menu>
            </menus>
        </MenuBar>          

                <GridPane AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="35.0">
                    <columnConstraints>
                        <ColumnConstraints hgrow="SOMETIMES" maxWidth="95.0" minWidth="10.0" prefWidth="74.0" />
                        <ColumnConstraints hgrow="SOMETIMES" maxWidth="125.0" minWidth="125.0" prefWidth="125.0" />
                        <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>
                    <children>
                        <Button mnemonicParsing="false" onAction="#handleInputRecord" text="Submit" GridPane.columnIndex="2">
                            <GridPane.margin>
                                <Insets left="5.0" />
                            </GridPane.margin>
                        </Button>
                        <Label text="Employee ID" />
                        <Label text="Asset ID" GridPane.rowIndex="1" />
                        <ComboBox fx:id="inputEmployeeIdField" minWidth="125.0" GridPane.columnIndex="1" />
                        <ComboBox fx:id="inputAssetIdField" minWidth="125.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                    </children>
                </GridPane>

                    </children>
        </AnchorPane>
        <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
            <children>
                <AnchorPane prefHeight="375.0" prefWidth="500.0" AnchorPane.topAnchor="125.0">
                    <children>
                        <TabPane nodeOrientation="LEFT_TO_RIGHT" prefHeight="375.0" prefWidth="500.0" tabClosingPolicy="UNAVAILABLE">
                            <tabs>
                                <Tab text="Overview">
                                    <content>
                                        <SplitPane dividerPositions="0.5761872909698996" focusTraversable="true">
                                            <items>
                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
                                                    <children>
                                                        <TableView fx:id="overviewTable" layoutX="-12.5" layoutY="58.0" prefHeight="320.0" prefWidth="175.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                                            <columns>

                                                                <TableColumn fx:id="overviewAssetIdColumn" minWidth="60.0" text="Asset ID" />
                                                                <TableColumn fx:id="overviewEmployeeIdColumn" minWidth="70.0" text="Employee ID" />
                                                                <TableColumn fx:id="overviewAssetNameColumn" minWidth="80.0" text="Asset Name" />
                                                                <TableColumn fx:id="overviewInventoryStatusColumn" minWidth="50.0" text="Status" />
                                                            </columns>
                                                            <columnResizePolicy>
                                                                <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
                                                            </columnResizePolicy>
                                                        </TableView>
                                                    </children>
                                                </AnchorPane>
                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="298.0" prefWidth="400.0">
                                                    <children>
                                                        <Label layoutX="7.0" layoutY="6.0" text="Overview Details:" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
                                                        <GridPane layoutX="14.0" layoutY="33.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0">
                                                            <columnConstraints>
                                                                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                                <ColumnConstraints />
                                                                <ColumnConstraints />
                                                                <ColumnConstraints />
                                                                <ColumnConstraints />
                                                                <ColumnConstraints />
                                                                <ColumnConstraints />
                                                            </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 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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                                                <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                                            </rowConstraints>
                                                            <children>
                                                                <Label text="Asset ID" />
                                                                <Label text="Asset Name" GridPane.rowIndex="1" />
                                                                <Label text="Manufacturer" GridPane.rowIndex="2" />
                                                                <Label text="Equipment Type" GridPane.rowIndex="3" />
                                                                <Label text="Employee ID" GridPane.rowIndex="4" />
                                                                <Label text="Employee Name" GridPane.rowIndex="5" />
                                                                <Label text="Check Out Date" GridPane.rowIndex="6" />
                                                                <Label fx:id="overviewAssetIdLabel" text="Label" GridPane.columnIndex="1" />
                                                                <Label fx:id="overviewAssetNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                                                                <Label fx:id="overviewManufacturerLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="2" />
                                                                <Label fx:id="overviewTypeLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" />
                                                                <Label fx:id="overviewEmployeeIdLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="4" />
                                                                <Label fx:id="overviewEmployeeNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="5" />
                                                                <Label fx:id="overviewCheckOutDateLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="6" />
                                                                <Label fx:id="overviewIdLabel" text="" GridPane.columnIndex="7" />
                                                            </children>
                                                        </GridPane>
                                                        <HBox layoutX="215.0" layoutY="259.0" spacing="5.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0">
                                                            <children>
                                                                <Button mnemonicParsing="false" onAction="#handleOverviewRefresh" text="Refresh" />
                                                            </children>
                                                        </HBox>

                                                    </children>
                                                </AnchorPane>
                                            </items>
                                        </SplitPane>
                                    </content>
                                </Tab>
                                <Tab text="Employees">
                                    <content>
                                        <SplitPane dividerPositions="0.42618729096989966" focusTraversable="true">
                                            <items>
                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
                                                    <children>
                                                        <TableView fx:id="employeeTable" layoutX="-12.5" layoutY="58.0" prefHeight="298.0" prefWidth="175.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                                            <columns>
                                                                <TableColumn fx:id="employeeFirstNameColumn" minWidth="102.0" text="First Name" />
                                                                <TableColumn fx:id="employeeLastNameColumn" minWidth="114.0" text="Last Name" />
                                                            </columns>
                                                            <columnResizePolicy>
                                                                <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
                                                            </columnResizePolicy>
                                                        </TableView>
                                                    </children>
                                                </AnchorPane>
                                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="298.0" prefWidth="393.0">
                                                    <children>
                                                        <Label layoutX="7.0" layoutY="6.0" text="Employee Details:" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
                                                        <GridPane layoutX="14.0" layoutY="33.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0">
                                                            <columnConstraints>
                                                                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                                                <ColumnConstraints />
                                                                <ColumnConstraints />
                                                                <ColumnConstraints />
                                                            </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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                                            </rowConstraints>
                                                            <children>
                                                                <Label text="Employee ID" />
                                                                <Label text="First Name" GridPane.rowIndex="1" />
                                                                <Label text="Last Name" GridPane.rowIndex="2" />
                                                                <Label text="Status" GridPane.rowIndex="3" />
                                                                <Label fx:id="employeeEmployeeIdLabel" text="Label" GridPane.columnIndex="1" />
                                                                <Label fx:id="employeeFirstNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                                                                <Label fx:id="employeeLastNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="2" />
                                                                <Label fx:id="employeeStatusLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" />
                                                                <Label fx:id="employeeIdLabel" text="" GridPane.columnIndex="4" />
                                                            </children>
                                                        </GridPane>
                                                        <HBox layoutX="215.0" layoutY="259.0" spacing="5.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0">
                                                            <children>
                                                                <Button mnemonicParsing="false" onAction="#handleNewEmployee" text="New..." />
                                                                <Button mnemonicParsing="false" onAction="#handleEditEmployee" text="Edit..." />
                                                                <Button mnemonicParsing="false" onAction="#handleDeleteEmployee" text="Delete" />
                                                            </children>
                                                        </HBox>
                                                    </children>
                                                </AnchorPane>
                                            </items>
                                        </SplitPane>
                                    </content>
                                </Tab>                                  
                            </tabs>
                        </TabPane>
                    </children>
                </AnchorPane>
            </children>
        </AnchorPane>
    </children>
</BorderPane>

共有1个答案

越文康
2023-03-14

我想出来了。我有一个额外的锚窗格它不喜欢。我删除了以下代码;

<AnchorPane prefHeight="125.0" prefWidth="500.0" AnchorPane.bottomAnchor="375.0">
<children>
</children>
</AnchorPane>
 类似资料:
  • 我喜欢用Javafx和FXML布局编写一个九人莫里斯游戏,我将使用场景生成器进行图形部分。 谁能给我写一个关于拖放的小例子吗?因为这是一场九人莫里斯的比赛,我只喜欢拖拽,并有一些我可以扔下碎片的点。

  • 考虑到这个例子,我如何从主代码中获取或设置表单上的任何内容? 我们只有一个简单的Main函数,如 FXML中定义的表单。 以及一个从不显式实例化的控制器类。 由于我在Main代码中没有到控制器类实例的链接,如何从控制器外部访问表单上的任何内容?

  • 我需要选择列表中的最后一项。下面的代码显示了该元素当前不可见的消息。如何解决这个问题? HTML: 列表的屏幕截图。该列表有一个搜索字段,用户可以在其中输入前缀以缩小搜索范围。

  • 问题内容: 由于增强的 多媒体功能,Webviewer和使用视觉效果的可能性,因此我在项目中使用JavaFX而不是Swing 。但是, 从网上 (http://docs.oracle.com/javafx/2/layout/jfxpub-layout.htm等)上 了解到的是JavaFX布局管理器专注于缩放父 基于所述内容的大小,而摇摆上论点集中缩放 根据父内容,至少基于所述Layout被 使用。

  • 问题内容: 我正在尝试单击具有文本克隆概念的范围。以下是html 我使用的javascript代码是: 我确认这是通过Firepath的元素的正确选择。 我还确保按照链接可见该元素。如何强制SeleniumWebDriver单击当前不可见的元素? 这是 计算的CSS 还尝试了以下代码: 异常: org.openqa.selenium.ElementNotVisibleException:元素当前不

  • 问题内容: 我正在尝试在Selenium Web驱动程序脚本下执行,但是几次(并非所有时间)都出现错误。有时在循环中第一次迭代,有时在2次迭代中,有时没有启动循环。它打印所有可用项目的计数正确,但是乳清试图单击项目,显示 问题答案: 终于这对我有用。元素当前不可见,因此可能无法与之交互。 最初,这就像测试只成功了5次中的2次一样。不确定有时如何运作,其他人则无法运作。 通过减少IE中的安全设置来工