一切顺利,然后我运行我的代码,我得到了这个错误。我已经尝试了以下解决方案(没有任何效果):http://stackoverflow.com/questions/22000423/javafx-and-maven-nullpointerexception-location-is-required应用程序启动方法 javafx gui 中的异常应用程序启动方法中的异常JavaFX“需要位置。” 即使它在同一个包中main.javapackage stockBot;import javafx.application.Application;import javafx.fxml.FXMLLoader;import javafx.scene.Parent;import javafx.scene.Scene;import javafx.stage.Stage;public class Main extends Application { @Override publi void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("resources/main.fxml")); primaryStage.setScene(new Scene(root)); primaryStage.show(); } public static void main(String[] args) { launch(args); }}主.fxml<?xml version="1.0" encoding="UTF-8"?><?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?><?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.text.Font?><AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="545.0" prefWidth="1024.0" styleClass="background" stylesheets="@application.css" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="stockBot.Main"> <children> <HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="50.0" prefWidth="1024.0" styleClass="background-bar" stylesheets="@application.css" /> <Button maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="20.0" prefWidth="20.0" styleClass="background-button-exit" stylesheets="@application.css" translateX="1000.0" translateY="12.0"> <graphic> <FontAwesomeIconView glyphName="CLOSE" size="16" /> </graphic> </Button>
添加回答
举报
0/150
提交
取消