- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我不断收到的错误代码:
Nov 26, 2019 12:33:25 AM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 11.0.1 by JavaFX runtime of version 8.0.221
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: javafx.fxml.LoadException: Error resolving onAction='#handlebuttonAction', either the event handler is not in the Namespace or there is an error in the script.
/D:/Eclipse%20Java/Workspace/EmployeeApp1/bin/application/Directory.fxml:83
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2597)
at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:103)
at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:610)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:770)
at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
at application.Main.showMainView(Main.java:27)
at application.Main.start(Main.java:20)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
... 1 more
Exception running application application.Main
我的教授告诉我这可能是我的应用程序的命名,我检查了一下,命名应该位于应用程序文件的正下方。这是我的程序的文件设置:
以下是我一直用来尝试通过运行 main.java 文件来显示此内容的代码:
Main.java
package application;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
public class Main extends Application {
@FXML private Stage primaryStage;
@FXML private BorderPane borderPane;
@Override
public void start(Stage primaryStage) throws IOException{
this.primaryStage = primaryStage;
this.primaryStage.setTitle("Assignment 5: by ");
showMainView();
}
private void showMainView() throws IOException{
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("Directory.fxml"));
borderPane = loader.load();
Scene scene = new Scene(borderPane);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
目录.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<TitledPane text="Assignment 5-Kevin Yuan" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.DirectoryController">
<content>
<BorderPane fx:id="borderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="350.0" prefWidth="320.0">
<opaqueInsets>
<Insets />
</opaqueInsets>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" />
</padding>
<center>
<BorderPane BorderPane.alignment="CENTER">
<right>
<GridPane BorderPane.alignment="CENTER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="62.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="245.0" minWidth="10.0" prefWidth="245.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="35.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="35.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="35.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="35.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="35.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="35.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label alignment="CENTER_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Name:" textAlignment="CENTER">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label alignment="CENTER_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Company:" textAlignment="CENTER" GridPane.rowIndex="1">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label alignment="CENTER_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="50.0" prefWidth="94.0" text="Extension:" textAlignment="RIGHT" GridPane.rowIndex="2">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<TextField fx:id="txtFldName" disable="true" promptText="First Last" GridPane.columnIndex="1">
<GridPane.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</GridPane.margin>
</TextField>
<TextField fx:id="txtFldCompany" disable="true" layoutX="89.0" layoutY="85.0" onKeyPressed="#btnLoad" promptText="department name" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<TextField fx:id="txtFldExt" disable="true" layoutX="94.0" layoutY="15.0" onKeyPressed="#btnLoad" promptText="Ext. number" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<HBox alignment="BOTTOM_RIGHT" GridPane.columnIndex="1" GridPane.rowIndex="3">
<children>
<Label fx:id="lblCurrRecord" alignment="CENTER" contentDisplay="CENTER" maxHeight="25.0" maxWidth="1.7976931348623157E308" minHeight="25.0" prefHeight="25.0" prefWidth="150.0" text="? of ?" textAlignment="CENTER">
<font>
<Font name="System Bold Italic" size="12.0" />
</font>
<HBox.margin>
<Insets bottom="5.0" />
</HBox.margin>
</Label>
<Button fx:id="btnNavDel" alignment="CENTER" contentDisplay="RIGHT" disable="true" maxWidth="35.0" minWidth="35.0" mnemonicParsing="false" onAction="#handlebuttonAction" onMouseClicked="#reactToClick" prefWidth="35.0" text="-">
<font>
<Font name="SansSerif Bold" size="12.0" />
</font>
<opaqueInsets>
<Insets left="20.0" />
</opaqueInsets>
<HBox.margin>
<Insets bottom="5.0" />
</HBox.margin>
</Button>
<Button fx:id="btnNavAdd" Visible="false" alignment="CENTER" disable="true" maxWidth="35.0" minWidth="35.0" mnemonicParsing="false" onAction="#handlebuttonAction" onMouseClicked="#reactToClick" prefWidth="35.0" text="+">
<font>
<Font name="SansSerif Bold" size="12.0" />
</font>
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
</Button>
</children>
</HBox>
<HBox alignment="BOTTOM_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.rowIndex="4">
<children>
<Button fx:id="btnNavPrev" alignment="CENTER" disable="true" maxWidth="35.0" minWidth="35.0" mnemonicParsing="false" onAction="#handlebuttonAction" onMouseClicked="#reactToClick" prefWidth="35.0" text="<<">
<font>
<Font name="SansSerif Bold" size="12.0" />
</font>
<HBox.margin>
<Insets bottom="5.0" />
</HBox.margin>
</Button>
<Button fx:id="btnNavNext" alignment="CENTER" disable="true" maxWidth="35.0" minWidth="35.0" mnemonicParsing="false" onAction="#handlebuttonAction" onMouseClicked="#reactToClick" prefWidth="35.0" text=">>">
<font>
<Font name="SansSerif Bold" size="12.0" />
</font>
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</children>
</GridPane>
</right>
</BorderPane>
</center>
<bottom>
<BorderPane BorderPane.alignment="CENTER">
<right>
<HBox BorderPane.alignment="CENTER">
<children>
<Button fx:id="btnLoad" alignment="TOP_RIGHT" mnemonicParsing="false" onAction="#handlebuttonAction" onMouseClicked="#reactToClick" text="Load" textAlignment="RIGHT">
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
</Button>
<Button fx:id="btnSerialize" alignment="CENTER" disable="true" mnemonicParsing="false" onAction="#handlebuttonAction" text="Serialize" textAlignment="RIGHT">
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</right>
<center>
<Label fx:id="lblFilename" maxHeight="25.0" maxWidth="1.7976931348623157E308" text="File: not set" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</bottom>
<top>
<Button fx:id="btnExit" alignment="CENTER" mnemonicParsing="false" onAction="#handlebuttonAction" onMouseClicked="#Save" onMouseReleased="#Exit" prefWidth="92.0" style="" text="Save and Exit" textAlignment="CENTER" BorderPane.alignment="TOP_RIGHT">
<font>
<Font name="System Bold" size="12.0" />
</font>
<BorderPane.margin>
<Insets bottom="10.0" top="5.0" />
</BorderPane.margin>
</Button>
</top>
</BorderPane>
</content>
</TitledPane>
最佳答案
Caused by: javafx.fxml.LoadException: Error resolving onAction='#handlebuttonAction', either the event handler is not in the Namespace or there is an error in the script.
/D:/Eclipse%20Java/Workspace/EmployeeApp1/bin/application/Directory.fxml:83
阅读上面的错误消息:事件处理程序不在命名空间中,或者脚本中存在错误。
,意味着您正在调用不存在的按钮按下方法。检查以下 FXML 代码行:
<Button fx:id="btnExit" alignment="CENTER" mnemonicParsing="false" onAction="#handlebuttonAction" onMouseClicked="#Save" onMouseReleased="#Exit" prefWidth="92.0" style="" text="Save and Exit" textAlignment="CENTER" BorderPane.alignment="TOP_RIGHT">
一个可能的解决方案:您可以从 FXML 代码中删除此 onAction="#handlebuttonAction"
。 (我上面提到的那一行。)
关于java - 这个fxml错误代码在JavaFx中意味着什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59044444/
我在 OS X 中构建菜单栏项时找到了一些示例代码。它使用了单个 |我不确定它的实际含义。 (我想做的是在菜单项左键单击时调用一个函数,但在右键单击时显示菜单) 这是我的代码 //Get refere
为什么它在第 23 行抛出编译错误。'a' 是 Apple 类的对象,col 是包含 Apple 对象的列表,但它仍然是抛出下面提到的编译错误: 类型 Collection 中的方法 add(capt
我有一个类A,它扩展了抽象类B。 让B有一个 protected 字段值 我想在 A 中使用这个字段。如果 A 没有 value,我可以编写 this.value 从 B 获取它。 与super.va
DBLint 用于检查数据库状态。有46条规则。在 www.dblint.org 上对每条规则都有一些简单的解释,但对规则 31 的描述如下: 定义的主键不是最小键:主键是最小的 super 键。如果
var aa: (()?) = (john.residence?.address = someAddress) var bb: ()? = john.residence?.printNumberOfR
我对 jquery 的可重用插件有点陌生。我已经多次遇到这段代码,但无法弄清楚究竟发生了什么。 (function( $ ){ ... })( jQuery ); 谁能帮我解答一下吗? 最佳答案
这个问题已经有答案了: int foo (int argc, ...) vs int foo() vs int foo(void) in C (4 个回答) 已关闭 9 年前。 所以我最近在 Hack
typedef struct Element { struct Element *next; void *data; } Element; 在 pop 函数中,(!(elem = *s
数据加载两次...意味着 AsyncTask onPostExecute 加载相同的数据两次?我的 AsyncTask onPostExecute 运行两次它加载相同的数据...我正在运行异步任务以从
运行“yomeanjs”时,我无限期地挂起“这可能需要几分钟”。当我尝试运行 grunt 时,它失败了,与 npm start 相同。 我使用的是 Win 8.1,并安装了最新的 Node 和 Mon
我正在看 big nerd ranch 的“Android Programming”中的这个页面,我对下面的句子感到困惑。它声明“当 Activity 被隐藏时, Activity 对象不存在”。这让
是否 const vector意味着它的元素是const也一样? 在下面的代码中, v[0].set (1234);在 void g ( const vector & v )产生编译器错误 const
我是 xml 相关事物的新手 我无法理解: SelectNodes(@"//Form/*[. = 'on']"); 注:SelectNodes是 XmlNode 的函数.(与 XmlDocument
我想方便地控制命令行参数。因此我想使用 ShellLib。 我的代码是这样的: ... #include ... EFI_STATUS EFIAPI UefiMain ( EFI_HANDL
着眼于更正 Debian 上/etc/init.d/hostapd 中的一个问题。但是,我不知道这行代码是做什么的,也不知道它是如何工作的 [ -n "$DAEMON_CONF" ] || exit
有没有人遇到过类似我下图所示的情况? 我有一个变量 landingBools.didSlowPast40Knots(正如您从调试打印输出中看到的那样)为假,但出于某种原因,if 语句评估为真。 知道为
我设法使用 flexbox 和一些非常基本的 JavaScript 为自己构建了三个下拉菜单。 因为我不太了解,所以我使用了一个简单的函数三次,而不是使用参数、变量和其他东西。我将其称为丑陋的“蛮力”
这周刚开始学习 javascript。我有一个非常菜鸟的问题。 exports.displayName = (undefined: ?string); 在 React Native 中意味着什么? 这
我正在阅读有关 NaN here 的内容它说: A comparison with a NaN always returns an unordered result even when compari
编码格式:引入*表示“从头开始重复”。例子。输入-{a,b,a,b,c,a,b,a,b,c,d}可以写成{a,b,*,c,*,d}。输出:5;例如2:ABCABCE,输出- 5。 这里*表示从头开始重
我是一名优秀的程序员,十分优秀!