Java告诉我他们找不到加载fxml文件的资源,但我不确定为什么考虑该文件确实在同一目录中。我知道如果fxml文件有问题,这个错误也可能会抛出;但如果是这种情况,我不知道如何排除故障。有人可以提供指导吗?
FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.web.WebView?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="714.0" prefWidth="699.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hotelmanagementsystemapp.ReservationSystemUIController">
<children>
<HBox maxHeight="100.0" maxWidth="1.7976931348623157E308" prefHeight="73.0" prefWidth="400.0" VBox.vgrow="ALWAYS">
<children>
<Button ellipsisString="~" maxHeight="1.7976931348623157E308" maxWidth="560.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="73.0" prefWidth="71.0" style="-fx-background-color: linear-gradient(#286487 0%, #5886A1 100%);" text="Home" textFill="WHITE" HBox.hgrow="ALWAYS">
<font>
<Font name="Avenir Book" size="19.0" />
</font>
<HBox.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</HBox.margin>
</Button>
<Button ellipsisString="~" maxHeight="1.7976931348623157E308" maxWidth="560.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="73.0" prefWidth="71.0" style="-fx-background-color: linear-gradient(#286487 0%, #5886A1 100%);" text="Reservation System" textAlignment="CENTER" textFill="WHITE" wrapText="true" HBox.hgrow="ALWAYS">
<font>
<Font name="Avenir Book" size="19.0" />
</font>
<HBox.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</HBox.margin>
</Button>
<Button ellipsisString="~" maxHeight="1.7976931348623157E308" maxWidth="560.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="73.0" prefWidth="71.0" style="-fx-background-color: linear-gradient(#286487 0%, #5886A1 100%);" text="Home" textFill="WHITE" HBox.hgrow="ALWAYS">
<font>
<Font name="Avenir Book" size="19.0" />
</font>
<HBox.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</HBox.margin>
</Button>
<Button ellipsisString="~" maxHeight="1.7976931348623157E308" maxWidth="560.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="73.0" prefWidth="71.0" style="-fx-background-color: linear-gradient(#286487 0%, #5886A1 100%);" text="Home" textFill="WHITE" HBox.hgrow="ALWAYS">
<font>
<Font name="Avenir Book" size="19.0" />
</font>
<HBox.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</HBox.margin>
</Button>
<Button ellipsisString="~" maxHeight="1.7976931348623157E308" maxWidth="560.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="73.0" prefWidth="71.0" style="-fx-background-color: linear-gradient(#286487 0%, #5886A1 100%);" text="Home" textFill="WHITE" HBox.hgrow="ALWAYS">
<font>
<Font name="Avenir Book" size="19.0" />
</font>
<HBox.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</HBox.margin>
</Button>
<Button ellipsisString="~" maxHeight="1.7976931348623157E308" maxWidth="560.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="73.0" prefWidth="71.0" style="-fx-background-color: linear-gradient(#286487 0%, #5886A1 100%);" text="Home" textFill="WHITE" HBox.hgrow="ALWAYS">
<font>
<Font name="Avenir Book" size="19.0" />
</font>
<HBox.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</HBox.margin>
</Button>
</children>
</HBox>
<Separator prefWidth="200.0" />
<SplitPane dividerPositions="0.381635581061693, 0.8694404591104734" prefHeight="284.0" prefWidth="699.0">
<items>
<VBox maxWidth="300.0" prefHeight="159.0" prefWidth="234.0" spacing="5.0">
<children>
<Label text="Booking Information:" />
<Separator prefWidth="200.0" />
<HBox prefHeight="33.0" prefWidth="144.0" style="-fx-border-color: #979797;">
<children>
<Label minHeight="33.0" minWidth="52.0" text="* From" />
<DatePicker maxWidth="1.7976931348623157E308" minHeight="27.0" minWidth="144.0" HBox.hgrow="ALWAYS" />
</children>
<padding>
<Insets left="5.0" right="5.0" top="5.0" />
</padding>
<opaqueInsets>
<Insets />
</opaqueInsets>
</HBox>
<HBox prefHeight="30.0" prefWidth="144.0" style="-fx-border-color: #979797;">
<children>
<Label minWidth="-Infinity" prefHeight="33.0" prefWidth="52.0" text="* To" HBox.hgrow="ALWAYS" />
<DatePicker maxWidth="1.7976931348623157E308" minHeight="27.0" minWidth="144.0" HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets top="5.0" />
</HBox.margin>
</DatePicker>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</HBox>
<HBox prefHeight="30.0" prefWidth="144.0" style="-fx-border-color: #979797;">
<children>
<Label minHeight="30.0" minWidth="79.0" text="Room Type" />
<ComboBox maxWidth="1.7976931348623157E308" minHeight="27.0" minWidth="115.0" HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets top="5.0" />
</HBox.margin>
</ComboBox>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</HBox>
<AnchorPane maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS">
<children>
<HBox minWidth="55.0" style="-fx-border-color: #979797;">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" minHeight="42.0" minWidth="39.0" text="No." textAlignment="CENTER" />
<ComboBox maxWidth="-Infinity" minHeight="27.0" minWidth="-Infinity" prefWidth="60.0" HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets top="8.0" />
</HBox.margin>
</ComboBox>
</children>
<padding>
<Insets right="8.0" />
</padding>
</HBox>
</children>
</AnchorPane>
<AnchorPane prefHeight="200.0" prefWidth="200.0">
<children>
<Button layoutX="174.0" layoutY="74.0" mnemonicParsing="false" style="-fx-background-color: #01B0EA;" text="SEARCH" textAlignment="CENTER" AnchorPane.bottomAnchor="7.0" AnchorPane.rightAnchor="7.0" />
</children>
</AnchorPane>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>
<HBox maxHeight="1.7976931348623157E308" SplitPane.resizableWithParent="false">
<children>
<BorderPane maxHeight="300.0" maxWidth="400.0" minWidth="-Infinity" prefHeight="197.0" prefWidth="255.0" HBox.hgrow="SOMETIMES">
<top>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="26.0" prefWidth="190.0" BorderPane.alignment="CENTER">
<children>
<Button maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="April" HBox.hgrow="SOMETIMES" />
</children>
</HBox>
</top>
<center>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
<children>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="29.0" prefWidth="190.0" VBox.vgrow="ALWAYS">
<children>
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="1" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="2" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="3" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="4" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="5" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="6" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="7" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="29.0" prefWidth="190.0" VBox.vgrow="ALWAYS">
<children>
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="8" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="9" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="10" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="11" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="12" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="13" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="14" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="29.0" prefWidth="190.0" VBox.vgrow="ALWAYS">
<children>
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="15" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="16" HBox.hgrow="ALWAYS">
<opaqueInsets>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</opaqueInsets>
</Button>
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="17" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="18" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="19" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="20" HBox.hgrow="ALWAYS" />
<Button ellipsisString="key.unspecifiedkey" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="21" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="29.0" prefWidth="190.0" VBox.vgrow="ALWAYS">
<children>
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="22" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="23" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="24" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="25" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="26" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="27" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="28" />
</children>
</HBox>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="29.0" prefWidth="190.0" VBox.vgrow="ALWAYS">
<children>
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="29" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="30" HBox.hgrow="ALWAYS" />
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="31" HBox.hgrow="ALWAYS" />
</children>
</HBox>
</children>
</VBox>
</center>
</BorderPane>
</children>
</HBox>
<WebView prefHeight="200.0" prefWidth="200.0" />
</items>
</SplitPane>
<HBox maxWidth="1.7976931348623157E308">
<children>
<Separator prefHeight="0.0" prefWidth="14.0">
<HBox.margin>
<Insets right="5.0" top="17.0" />
</HBox.margin>
</Separator>
<Label minHeight="-Infinity" minWidth="-Infinity" prefHeight="32.0" prefWidth="83.0" style="-fx-background-color: #3D91C1;" text="Available" textFill="WHITE">
<font>
<Font size="17.0" />
</font>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</Label>
<Separator prefHeight="0.0" prefWidth="538.0" HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets left="5.0" right="5.0" top="17.0" />
</HBox.margin>
</Separator>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</HBox>
<TableView maxWidth="1.7976931348623157E308" prefHeight="282.0" prefWidth="699.0" stylesheets="@reservationsystemui.css" VBox.vgrow="ALWAYS">
<columns>
<TableColumn maxWidth="775.0" minWidth="109.0" prefWidth="109.0" text="Room No." />
<TableColumn maxWidth="1065.0" minWidth="149.0" prefWidth="149.0" text="Duration" />
<TableColumn maxWidth="1140.0" minWidth="160.0" prefWidth="160.0" text="Notes" />
<TableColumn maxWidth="929.0" minWidth="130.0" prefWidth="130.0" text="Add. Packages" />
<TableColumn maxWidth="1070.0" minWidth="150.0" prefWidth="150.0" text="Action" />
</columns>
</TableView>
</children>
</VBox>
目录结构:
public void start(Stage stage) throws IOException
{
Parent root = FXMLLoader.load(getClass().getResource("ReservationSystemUI.fxml")); //<— ERROR
Scene scene = new Scene(root);
stage.setScene(scene);
stage.sizeToScene();
stage.setMinWidth(scene.widthProperty().doubleValue());
stage.setMinHeight(scene.heightProperty().doubleValue());
stage.show();
}
堆栈追踪:
Executing /Users/norriswise/NetBeansProjects/HotelManagementSystemApp/dist/run1290999908/HotelManagementSystemApp.jar using platform /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java
Feb 12, 2018 9:52:26 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 9 by JavaFX runtime of version 8.0.131
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
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$155(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: javafx.fxml.LoadException: No resources specified. //<— ERROR
file:/Users/norriswise/NetBeansProjects/HotelManagementSystemApp/dist/run1290999908/HotelManagementSystemApp.jar!/hotelmanagementsystemapp/ReservationSystemUI.fxml:182
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2597)
at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:103)
at javafx.fxml.FXMLLoader$Element.resolvePrefixedValue(FXMLLoader.java:421)
at javafx.fxml.FXMLLoader$Element.processValue(FXMLLoader.java:363)
at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:325)
at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:235)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:767)
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.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at hotelmanagementsystemapp.HotelManagementSystemApp.start(HotelManagementSystemApp.java:29)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Exception running application hotelmanagementsystemapp.HotelManagementSystemApp
Java Result: 1
Deleting directory /Users/norriswise/NetBeansProjects/HotelManagementSystemApp/dist/run1290999908
jfxsa-run:
BUILD SUCCESSFUL (total time: 2 seconds)
答案 0 :(得分:2)
我发布这个答案是因为我自己想出来了。 感谢@James_D的提示。
对于按钮,如果框太小,则需要使用ellipsisString属性指定一个键来替换按钮中的字符串。 %key.unspecifiedkey.unspecified
无效,将查找外部资源(如果没有给出),将导致程序崩溃。
<Button ellipsisString="%key.unspecifiedkey.unspecified" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="15" HBox.hgrow="ALWAYS" />
%key.unspecifiedkey.unspecified
需要替换为您正在使用的任何符号。我正在使用~
:
<Button ellipsisString="~" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="27.0" prefWidth="19.0" text="15" HBox.hgrow="ALWAYS" />