一切順利,然后我運行我的代碼,我得到了這個錯誤。我已經(jīng)嘗試了以下解決方案(沒有任何效果):http://stackoverflow.com/questions/22000423/javafx-and-maven-nullpointerexception-location-is-required應(yīng)用程序啟動方法 javafx gui 中的異常應(yīng)用程序啟動方法中的異常JavaFX“需要位置?!?nbsp;即使它在同一個包中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
提交
取消