Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在scenebuilder 2.0中找不到控制器_Java_User Interface_Javafx_Javafx 8_Scenebuilder - Fatal编程技术网

Java 在scenebuilder 2.0中找不到控制器

Java 在scenebuilder 2.0中找不到控制器,java,user-interface,javafx,javafx-8,scenebuilder,Java,User Interface,Javafx,Javafx 8,Scenebuilder,我只是想知道我是否能得到一些帮助,因为我目前正在使用SceneBuilder 2.0为我的软件构建GUI。我有一个问题,但我无法链接的文件与控制器,即使他们目前在同一个文件夹中的项目 对此问题的任何帮助都将不胜感激 谢谢 编辑:请按要求查找以下Java控制器类: package rucmView; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.MenuItem; pu

我只是想知道我是否能得到一些帮助,因为我目前正在使用SceneBuilder 2.0为我的软件构建GUI。我有一个问题,但我无法链接的文件与控制器,即使他们目前在同一个文件夹中的项目

对此问题的任何帮助都将不胜感激

谢谢

编辑:请按要求查找以下Java控制器类:

package rucmView;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.MenuItem;

public class GherkinController {

    @FXML
    private MenuItem exit;

    @FXML
    void ExitApplication(ActionEvent event) {

    }

}
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <SplitPane dividerPositions="0.29797979797979796" layoutY="31.0" prefHeight="570.0" prefWidth="600.0">
        <items>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="403.0" prefWidth="174.0">
               <children>
                  <GridPane layoutX="1.0" layoutY="114.0" prefHeight="324.0" prefWidth="174.0">
                    <columnConstraints>
                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                    </rowConstraints>
                     <children>
                        <Button alignment="CENTER" mnemonicParsing="false" prefHeight="31.0" prefWidth="137.0" text="Load Test Case" textAlignment="CENTER" GridPane.columnIndex="1" />
                        <Button mnemonicParsing="false" prefHeight="31.0" prefWidth="139.0" text="Create Defs" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                        <Button mnemonicParsing="false" prefHeight="31.0" prefWidth="127.0" text="Exit Application" GridPane.columnIndex="1" GridPane.rowIndex="3" />
                        <Button mnemonicParsing="false" prefHeight="31.0" prefWidth="128.0" text="Seleniun View" GridPane.columnIndex="1" GridPane.rowIndex="2" />
                     </children>
                  </GridPane>
               </children></AnchorPane>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="385.0" prefWidth="416.0">
               <children>
                  <TextArea prefHeight="251.0" prefWidth="416.0" text="Sample Gherkin Script:&#10;&#10;Feature: Openwebpage&#10;This is going to be a test to ensure that the selenium &#10;webdriver is able to open up the tests as intended.&#10;&#10;Scenario: Successfully opening Website.&#10;&#10;Given user navigates to Website&#10;&#10;Then navigate to Link-1 Homepage &#10;&#10;" wrapText="true" />
                  <TextArea layoutY="262.0" prefHeight="296.0" prefWidth="416.0" text="Test Case Validation:&#10;&#10;Checks to see if the Gherkin script is syntactically correct and valid." wrapText="true" />
               </children></AnchorPane>
        </items>
      </SplitPane>
      <MenuBar prefHeight="32.0" prefWidth="600.0">
        <menus>
          <Menu mnemonicParsing="false" text="File">
            <items>
              <MenuItem mnemonicParsing="false" text="Save Results" />
                  <MenuItem fx:id="exit" mnemonicParsing="false" onAction="#ExitApplication" text="Close" />
            </items>
          </Menu>
          <Menu mnemonicParsing="false" text="View">
            <items>
              <MenuItem mnemonicParsing="false" text="Selenium" />
                  <MenuItem mnemonicParsing="false" text="Gherkin/RUCM" />
            </items>
          </Menu>
            <Menu mnemonicParsing="false" text="Selenium">
               <items>
                  <MenuItem mnemonicParsing="false" text="Chrome" />
                  <MenuItem mnemonicParsing="false" text="FireFox" />
               </items>
            </Menu>
            <Menu mnemonicParsing="false" text="Help">
               <items>
                  <MenuItem mnemonicParsing="false" text="Guide" />
               </items>
            </Menu>
        </menus>
      </MenuBar>
   </children>
</AnchorPane>
请按照要求查找FXML类:

package rucmView;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.MenuItem;

public class GherkinController {

    @FXML
    private MenuItem exit;

    @FXML
    void ExitApplication(ActionEvent event) {

    }

}
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <SplitPane dividerPositions="0.29797979797979796" layoutY="31.0" prefHeight="570.0" prefWidth="600.0">
        <items>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="403.0" prefWidth="174.0">
               <children>
                  <GridPane layoutX="1.0" layoutY="114.0" prefHeight="324.0" prefWidth="174.0">
                    <columnConstraints>
                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                    </rowConstraints>
                     <children>
                        <Button alignment="CENTER" mnemonicParsing="false" prefHeight="31.0" prefWidth="137.0" text="Load Test Case" textAlignment="CENTER" GridPane.columnIndex="1" />
                        <Button mnemonicParsing="false" prefHeight="31.0" prefWidth="139.0" text="Create Defs" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                        <Button mnemonicParsing="false" prefHeight="31.0" prefWidth="127.0" text="Exit Application" GridPane.columnIndex="1" GridPane.rowIndex="3" />
                        <Button mnemonicParsing="false" prefHeight="31.0" prefWidth="128.0" text="Seleniun View" GridPane.columnIndex="1" GridPane.rowIndex="2" />
                     </children>
                  </GridPane>
               </children></AnchorPane>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="385.0" prefWidth="416.0">
               <children>
                  <TextArea prefHeight="251.0" prefWidth="416.0" text="Sample Gherkin Script:&#10;&#10;Feature: Openwebpage&#10;This is going to be a test to ensure that the selenium &#10;webdriver is able to open up the tests as intended.&#10;&#10;Scenario: Successfully opening Website.&#10;&#10;Given user navigates to Website&#10;&#10;Then navigate to Link-1 Homepage &#10;&#10;" wrapText="true" />
                  <TextArea layoutY="262.0" prefHeight="296.0" prefWidth="416.0" text="Test Case Validation:&#10;&#10;Checks to see if the Gherkin script is syntactically correct and valid." wrapText="true" />
               </children></AnchorPane>
        </items>
      </SplitPane>
      <MenuBar prefHeight="32.0" prefWidth="600.0">
        <menus>
          <Menu mnemonicParsing="false" text="File">
            <items>
              <MenuItem mnemonicParsing="false" text="Save Results" />
                  <MenuItem fx:id="exit" mnemonicParsing="false" onAction="#ExitApplication" text="Close" />
            </items>
          </Menu>
          <Menu mnemonicParsing="false" text="View">
            <items>
              <MenuItem mnemonicParsing="false" text="Selenium" />
                  <MenuItem mnemonicParsing="false" text="Gherkin/RUCM" />
            </items>
          </Menu>
            <Menu mnemonicParsing="false" text="Selenium">
               <items>
                  <MenuItem mnemonicParsing="false" text="Chrome" />
                  <MenuItem mnemonicParsing="false" text="FireFox" />
               </items>
            </Menu>
            <Menu mnemonicParsing="false" text="Help">
               <items>
                  <MenuItem mnemonicParsing="false" text="Guide" />
               </items>
            </Menu>
        </menus>
      </MenuBar>
   </children>
</AnchorPane>

  • 确保控制器是公共的
  • fx:controller
    需要控制器类的完整包路径
      • 确保控制器是公共的
      • fx:controller
        需要控制器类的完整包路径
      你能发布FXML和控制器类声明吗?嗨,比约恩,刚刚将它们添加到帖子中,控制器类是public,你能发布FXML和控制器类声明吗?嗨,比约恩,刚刚将它们添加到帖子中,控制器类是public,我面临着同样的问题。当在
      fx:controller
      中提到我的控制器时,fxml文件无法检测到我的控制器类。我的控制器是公共的,我面临同样的问题。当在
      fx:controller
      中提到我的控制器也是公共的时,fxml文件无法检测到我的控制器类