Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/333.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 fxml TableView中出现错误_Java_Javafx 2_Fxml - Fatal编程技术网

Java fxml TableView中出现错误

Java fxml TableView中出现错误,java,javafx-2,fxml,Java,Javafx 2,Fxml,我创建描述表的FXML文件 <AnchorPane fx:id="AnchorPane" id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml" fx:controller="ru.pfr03.spru

我创建描述表的FXML文件

 <AnchorPane fx:id="AnchorPane" id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml" fx:controller="ru.pfr03.sprut.client.UnittypeController"> 
      <children> 
        <TableView fx:id="unitTypeTableView" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> 
          <TableColumn prefWidth="100.0" text="Код"> 
          </TableColumn> 
          <TableColumn prefWidth="125.0" text="Наименование"> 
          </TableColumn> 
        </TableView> 
      </children> 
    </AnchorPane> 
如何修复此错误?
谢谢

在fxml文件中用
包装
表格列
s

public class UnittypeController implements Initializable { 
    @FXML 
    private TableView<Unittype> unitTypeTableView; 

    @Override 
    public void initialize(URL url, ResourceBundle rb) { 

    }   
} 
Exception in Application start method 
java.lang.reflect.InvocationTargetException 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
        at java.lang.reflect.Method.invoke(Method.java:601) 
        at com.javafx.main.Main.launchApp(Main.java:453) 
        at com.javafx.main.Main.main(Main.java:537) 
Caused by: java.lang.RuntimeException: Exception in Application start method 
        at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source) 
        at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source) 
        at com.sun.javafx.application.LauncherImpl$1.run(Unknown Source) 
        at java.lang.Thread.run(Thread.java:722) 
Caused by: javafx.fxml.LoadException: javafx.scene.control.TableView does not have a default property. 
        at javafx.fxml.FXMLLoader$ValueElement.processEndElement(Unknown Source) 
        at javafx.fxml.FXMLLoader.processEndElement(Unknown Source) 
        at javafx.fxml.FXMLLoader.load(Unknown Source) 
        at javafx.fxml.FXMLLoader.load(Unknown Source) 
        at javafx.fxml.FXMLLoader.load(Unknown Source) 
        at javafx.fxml.FXMLLoader.load(Unknown Source) 
        at ru.pfr03.sprut.client.Sprutclient.start(Sprutclient.java:40) 
        at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source) 
        at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source) 
        at com.sun.javafx.application.PlatformImpl$3.run(Unknown Source) 
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) 
        at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source) 
        at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source) 
        ... 1 more