第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

JavaFX 錯(cuò)誤:事件處理程序不在命名空間中

JavaFX 錯(cuò)誤:事件處理程序不在命名空間中

瀟瀟雨雨 2023-08-04 15:50:19
我正在創(chuàng)建一個(gè) JavaFX 應(yīng)用程序。我可以啟動(dòng)應(yīng)用程序并登錄,但是當(dāng)我嘗試訪問客戶場(chǎng)景時(shí),出現(xiàn)以下錯(cuò)誤:(提前對(duì)所有代碼和錯(cuò)誤表示歉意;不想遺漏任何內(nèi)容)這是 CustomersScene.fxml:<?xml version="1.0" encoding="UTF-8"?><?import javafx.scene.control.Button?><?import javafx.scene.control.Label?><?import javafx.scene.control.TableColumn?><?import javafx.scene.control.TableView?><?import javafx.scene.layout.AnchorPane?><?import javafx.scene.layout.HBox?><?import javafx.scene.layout.VBox?><?import javafx.scene.text.Font?><AnchorPane id="AnchorPane" prefHeight="591.0" prefWidth="475.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="c195.CustomersSceneController">   <children>      <VBox layoutY="51.0" prefHeight="541.0" prefWidth="500.0">         <children>            <TableView fx:id="customerTableView" prefHeight="470.0" prefWidth="500.0">              <columns>                <TableColumn fx:id="customerTableNameTableColumn" prefWidth="75.0" text="Name" />                <TableColumn fx:id="customerTableAddressTableColumn" prefWidth="302.0" text="Address" />                  <TableColumn fx:id="customerTablePhoneNumberTableColumn" minWidth="0.0" prefWidth="122.0" text="Phone Number" />              </columns>            </TableView>            <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="100.0">               <children>                  <Button fx:id="addCustomerButton" mnemonicParsing="false" onAction="#addCustomerButtonPushed" prefHeight="30.0" prefWidth="60.0" text="Add" />                  <Button fx:id="modifyCustomerButton" mnemonicParsing="false" onAction="#modifyCustomerButtonPushed" prefHeight="30.0" prefWidth="60.0" text="Modify" />                  <Button fx:id="deleteCustomerButton" mnemonicParsing="false" onAction="#deleteCustomerButtonPushed" prefHeight="30.0" prefWidth="60.0" text="Delete" />               </children>該錯(cuò)誤表明它找不到事件處理程序。我不知道為什么,因?yàn)槲乙褜?@FXML 附加到該函數(shù)。我還嘗試將函數(shù)公開(fxml 文檔仍然建議這兩個(gè)函數(shù),該文檔在第 27 行顯示錯(cuò)誤 - > #deleteCustomerButtonPushed) 我已檢查所有導(dǎo)入語句以確保使用 JavaFX 版本。
查看完整描述

3 回答

?
開滿天機(jī)

TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超13個(gè)贊

您收到的 IncationTargetException 意味著系統(tǒng)正在嘗試查找特定方法,但無法找到合適的候選方法。正如錯(cuò)誤所示:“事件處理程序不在命名空間中”。


問題來自于你的方法的簽名:


@FXML private void deleteCustomerButtonPushed(Customer customer) {

    //...

}

參數(shù)應(yīng)該像ActionEvent其他方法一樣,而不是Customer.


@FXML private void deleteCustomerButtonPushed(ActionEvent e) {

     //...   

}


查看完整回答
反對(duì) 回復(fù) 2023-08-04
?
眼眸繁星

TA貢獻(xiàn)1873條經(jīng)驗(yàn) 獲得超9個(gè)贊

也可能是由于

使用

import java.awt.event.ActionEvent;

代替

import javafx.event.ActionEvent;


查看完整回答
反對(duì) 回復(fù) 2023-08-04
?
叮當(dāng)貓咪

TA貢獻(xiàn)1776條經(jīng)驗(yàn) 獲得超12個(gè)贊

我收到此錯(cuò)誤的原因是我錯(cuò)過了@FXML方法聲明

是這樣的

private void onCheckboxToggle(ActionEvent event) {

添加了@FXML

@FXML
private void onCheckboxToggle(ActionEvent event) {

我的自定義組件(沒什么特別的):

<CheckBox fx:id="completed" onAction="#onCheckboxToggle" />


查看完整回答
反對(duì) 回復(fù) 2023-08-04
  • 3 回答
  • 0 關(guān)注
  • 163 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)