JAVAFX FXML中找不到TableColumn绑定的方法 40C

如题,JAVAFX FXML中找不到TableColumn绑定的方法
EditAssignmentGradesController的主要相关代码片段如下

package sample;

import java.util.Map;

import Model.Record;
import Model.Student;
import Model.Subject;
import Model.Score;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.cell.TextFieldTableCell;


public class EditAssignmentGradesController {
    @FXML
    private TableView<Record> recordTable;
    @FXML
    private TableColumn<Record, String> nameColumn;
    @FXML
    private TableColumn<Record, String> gradeColumn;
    @FXML
    private TableColumn<Record, String> bonusColumn;
    @FXML
    void onEditName(TableColumn.CellEditEvent<String, String> ddd) {
        Record record = recordTable.getSelectionModel().getSelectedItem();
        record.setName(ddd.getNewValue());
    }

    @FXML
    private void onEditPoints(TableColumn.CellEditEvent<Record, String> pointsCellEdited) {
        Record record = recordTable.getSelectionModel().getSelectedItem();
        record.setPoints(pointsCellEdited.getNewValue());
    }

    @FXML
    private Label assignmentLabel;
    @FXML
    private Label maxscoreLabel;
    @FXML
    private TextArea commentsArea;
    private int gradeWay;

    private Subject subject;
    private ObservableList<Record> recordData = FXCollections.observableArrayList();;

FXML中这一段一直显示
The controller 'EditAssignmentGradesController' has no event slot 'onEditName'
图片说明

整体代码如下

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

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>

<AnchorPane prefHeight="400.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.EditAssignmentGradesController">
   <children>
      <Label layoutX="39.0" layoutY="43.0" text="Assignment:" />
      <Label fx:id="assignmentLabel" layoutX="113.0" layoutY="43.0" text="Label" />
      <Label layoutX="178.0" layoutY="43.0" text="How is this grade calculated?" />
      <Label layoutX="39.0" layoutY="70.0" text="Max Score:" />
      <Label fx:id="maxscoreLabel" layoutX="113.0" layoutY="70.0" text="Label" />
      <TableView fx:id="recordTable" layoutX="41.0" layoutY="100.0" prefHeight="130.0" prefWidth="300.0">
        <columns>
          <TableColumn fx:id="nameColumn" onEditCommit="#onEditName" prefWidth="75.0" sortable="false" style="-fx-background-color: #66CCFF;" text="Student Name" />
          <TableColumn fx:id="gradeColumn" onEditCommit="#onEditPoints" prefWidth="75.0" sortable="false" style="-fx-background-color: #66CCFF;" text="Grade" />
            <TableColumn fx:id="bonusColumn"  prefWidth="75.0" sortable="false" style="-fx-background-color: #66CCFF;" text="Bonus" />
        </columns>
         <columnResizePolicy>
            <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
         </columnResizePolicy>
      </TableView>
      <Label layoutX="41.0" layoutY="263.0" text="Comments:" />
      <TextArea fx:id="commentsArea" layoutX="113.0" layoutY="253.0" prefHeight="80.0" prefWidth="222.0" />
      <Button layoutX="309.0" layoutY="361.0" mnemonicParsing="false" onAction="#handleSave" text="Save" />
      <RadioButton layoutX="148.0" layoutY="70.0" mnemonicParsing="false" onAction="#percentWay" text="Percent" />
      <RadioButton layoutX="216.0" layoutY="70.0" mnemonicParsing="false" onAction="#lostWay" text="Points Lost" />
      <RadioButton layoutX="302.0" layoutY="70.0" mnemonicParsing="false" onAction="#rawWay" text="Raw Points" />
   </children>
</AnchorPane>

当去除onEditName()的参数的时候,FXML文件里就不会报错,但是加上就会报错,试了半天不知道原因,恳请各位指点

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问