javafx.fxml.LoadException第11行的Java Fxml异常,代码未执行

时间:2019-04-02 18:21:46

标签: java javafx fxml fxmlloader

我正在尝试将我的sample.fxml文件与另一个名为{name的变量一起链接到另一个文件open.fxml,但是它显示:

出了点问题:javafx.fxml.LoadException: / C:/Users/Sherrinford/Documents/Github/out/production/Jnotebook/sample/open.fxml:11`

以代码形式显示为错误,因此我无法解决此异常,我已经尝试了一切,但无法解决此错误,有人可以帮我解决吗?

Open.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.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1037.0"
            prefWidth="891.0"
            style="-fx-background-color: #A4B0BD;" xmlns="http://javafx.com/javafx/10.0.1"
            xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.openController">
   <children>
      <Label layoutX="26.0" layoutY="14.0" prefHeight="50.0" prefWidth="296.0" text="Jnotebook" underline="true">
         <font>
            <Font name="GeoSlab703 Md BT Bold" size="50.0"/>
         </font>
      </Label>
      <Label fx:id="file_name_1" alignment="CENTER" layoutX="644.0" layoutY="25.0" prefHeight="38.0" prefWidth="190.0"
             text="File Name">
         <font>
            <Font name="System Bold" size="18.0"/>
         </font>
      </Label>
      <Label layoutX="25.0" layoutY="110.0" prefHeight="32.0" prefWidth="333.0" style="-fx-text-fill: green;"
             text="Enter Names of Modules to be imported">
         <font>
            <Font name="System Bold" size="16.0"/>
         </font>
      </Label>
      <TextArea layoutX="27.0" fx:id="modules_import" layoutY="158.0" prefHeight="182.0" prefWidth="334.0"
                style="-fx-border-color: black;">
         <font>
            <Font size="16.0"/>
         </font>
         <opaqueInsets>
            <Insets/>
         </opaqueInsets>
      </TextArea>
      <Label layoutX="24.0" layoutY="357.0" prefHeight="32.0" prefWidth="334.0" style="-fx-text-fill: green;"
             text="Write your Java Main Class Below">
         <font>
            <Font name="System Bold" size="16.0"/>
         </font>
      </Label>
      <TextArea layoutX="26.0" fx:id="main_code" layoutY="404.0" prefHeight="226.0" prefWidth="837.0"
                style="-fx-border-color: black;">
         <padding>
            <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
         </padding>
         <font>
            <Font size="18.0"/>
         </font>
      </TextArea>
      <Button layoutX="214.0" layoutY="657.0" onAction="#compile_file" mnemonicParsing="false" prefHeight="38.0"
              prefWidth="114.0" style="-fx-background-color: yellow; -fx-text-fill: black;" text="Compile">
         <font>
            <Font size="16.0"/>
         </font>
      </Button>
      <Button layoutX="405.0" onAction="#run_code" layoutY="657.0" mnemonicParsing="false" prefHeight="38.0"
              prefWidth="114.0" style="-fx-background-color: green; -fx-text-fill: white;" text="Run">
         <font>
            <Font size="16.0"/>
         </font>
      </Button>
      <TextArea layoutX="401.0" fx:id="classes" layoutY="158.0" prefHeight="182.0" prefWidth="465.0"
                style="-fx-border-color: black;"/>
      <Label layoutX="401.0" layoutY="110.0" prefHeight="32.0" prefWidth="296.0" style="-fx-text-fill: green;"
             text="Define Classes Below">
         <font>
            <Font name="System Bold" size="16.0"/>
         </font>
      </Label>
      <Button layoutX="581.0" layoutY="657.0" mnemonicParsing="false" prefHeight="38.0" prefWidth="114.0"
              style="-fx-background-color: red; -fx-text-fill: white;" text="Clear Code">
         <font>
            <Font size="16.0"/>
         </font>
      </Button>
      <Label alignment="CENTER" layoutX="357.0" layoutY="707.0" prefHeight="32.0" prefWidth="174.0" text="Output"
             underline="true">
         <font>

            <Font name="System Bold" size="20.0"/>
         </font>
      </Label>
      <TextArea layoutX="29.0" fx:id="Output" text="Output Here" layoutY="739.0" prefHeight="189.0" prefWidth="830.0"
                style="-fx-border-color: red;"/>
   </children>
</AnchorPane>


Controller.java

package sample;

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

import java.sql.*;

public class Controller {
    @FXML
    public ListView filelist;
    public TextField file_pro_name;
    public Label error_message;

    public void createnew() {

        //dATABASE BLOCK

        try{
            Connection conn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\sherrinford\\Documents\\Github\\testjava.db");
            try {
                Statement statement = conn.createStatement();
                statement.execute("Create Table file_Name (Address VARCHAR(100),Parent_file VARCHAR(20))");
                statement.close();

            }
            catch(Exception e){
                System.out.println("Table already exits "+e);
            }

            String Check="SELECT COUNT(*) FROM  file_Name WHERE Parent_file=?";
            PreparedStatement chk_statement = null;
            chk_statement=conn.prepareStatement(Check);
            chk_statement.setString(1,file_pro_name.getText());
            ResultSet rs=chk_statement.executeQuery();
            int counter =rs.getInt("COUNT(*)");
            chk_statement.close();
            if(counter>0 || (file_pro_name.getText() == "")){
                error_message.setVisible(true);
                error_message.setText("File Name Already Exists!! Please Choose another one");
            }
            else {
                if (file_pro_name.getText().isEmpty())
                {
                    System.out.println("File name field cannot be left empty !");
                    error_message.setVisible(true);
                    error_message.setText("File name field cannot be left empty !");
                }
                else
                {
                    error_message.setVisible(false);
                    String sql_insert = "Insert INTO file_Name (Address,Parent_file) values (?,?)";
                    PreparedStatement ps = null;
                    ps = conn.prepareStatement(sql_insert);
                    ps.setString(1, "C:\\"+file_pro_name.getText()+".java");
                    ps.setString(2, file_pro_name.getText());
                    ps.execute();
                    ps.close();
                    try

                    {
                        FXMLLoader fxmlLoad = new FXMLLoader(getClass().getResource("/sample/open.fxml"));
                        System.out.println("Correct Here");
                        Parent root1 =  FXMLLoader.load(Controller.class.getResource("/sample/open.fxml"));
                        openController openController = fxmlLoad.getController();
                        openController.setFile_name(String.valueOf(file_pro_name.getText()));
                        Stage stage = new Stage();
                        stage.setTitle(String.valueOf(file_pro_name.getText())+".java");
                        stage.setScene(new Scene(root1,900,1000));
                        stage.show();

                    }
                    catch (Exception e)
                    {
                        System.out.println("Something Went Wrong:"+e);
                    }
                }

            }
            conn.close();
        }
        catch(SQLException e){
            System.out.println("Something Went Wrong!  "+e);
        }

    }

    public void refresh() {
        //clearing listView

        filelist.getItems().clear();

        //dATABASE BLOCK
        try{
            Connection conn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\sherrinford\\Documents\\Github\\testjava.db");
            try {
                Statement statement = conn.createStatement();
                statement.execute("Create Table file_Name (Address VARCHAR(100),Parent_file VARCHAR(20))");
                statement.close();

            }
            catch(Exception e){
                    System.out.println("Table already exits "+e);
            }
            String s ="Select * from file_name";
            Statement ps = conn.createStatement();
            try {
                ResultSet rs = ps.executeQuery(s);
                while(rs.next()){
                    String file_name =  rs.getString("Parent_file");
                    System.out.println(file_name);
                    filelist.getItems().add(file_name+".Java");
                }
            } catch (SQLException e) {
                e.printStackTrace();
            }
            ps.close();
            conn.close();
        }
        catch(SQLException e){
            System.out.println("Something Went Wrong!  "+e);
        }
    }

}

openController.java

package sample;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;

import java.io.*;
import java.net.URL;
import java.util.ResourceBundle;

public class openController implements Initializable
 {
    public TextArea modules_import;
    public TextArea main_code;
    public TextArea Output;
    public TextArea classes;
    public Label file_name_1;
    String file_name_1_java=file_name_1.getText();
     @Override
     public void initialize(URL location, ResourceBundle resources)
     {

     }
     public void setFile_name(String text)
     {
         file_name_1.setText(text + ".java");
     }

     public void compile_file(ActionEvent actionEvent) {
        try
        {
            System.out.println(modules_import.getText()+"\n"+main_code.getText()+"\n"+classes.getText());
            String final_string = modules_import.getText()+ "\n public class abc{ \n \t" + classes.getText()+"\n \t  public static void main(String argv[]) { \n \t"+main_code.getText()+" \n \t } \n }";
            try{
                FileWriter fw=new FileWriter("C:\\Users\\Sherrinford\\Documents\\Github\\src\\batch\\programs\\"+file_name_1_java+".java");
                fw.write(final_string);
                fw.close();
            }
            catch(Exception e){
                System.out.println(e);
            }

            System.out.println("Success...");

            ProcessBuilder pb = new ProcessBuilder("cmd", "/c","Start", "Main.bat",file_name_1_java);
            File dir = new File("C:\\Users\\Sherrinford\\Documents\\Github\\src\\batch");
            pb.directory(dir);
            Process p = pb.start();
        }
        catch (Exception e)
        {
            System.out.println("HEY Buddy ! U r Doing Something Wrong ");
            e.printStackTrace();
        }

        try (BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Sherrinford\\Documents\\Github\\src\\batch\\output_"+file_name_1_java+".txt"))) {

            String sCurrentLine;
            String output_string="";
            while ((sCurrentLine = br.readLine()) != null) {
                System.out.println(sCurrentLine);
                output_string+=sCurrentLine+"\n";
            }
            Output.setText(output_string);
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void run_code(ActionEvent actionEvent) {

        try
        {
            System.out.println(modules_import.getText()+"\n"+main_code.getText()+"\n"+classes.getText());
            String final_string = modules_import.getText()+ "\n public class abc{ \n \t" + classes.getText()+"\n \t  public static void main(String argv[]) { \n \t"+main_code.getText()+" \n \t } \n }";
            try{
                FileWriter fw=new FileWriter("C:\\Users\\Sherrinford\\Documents\\Github\\src\\batch\\programs\\"+file_name_1_java+".java");
                fw.write(final_string);
                fw.close();
            }
            catch(Exception e){
                System.out.println(e);
            }

            System.out.println("Success...");

            ProcessBuilder pb = new ProcessBuilder("cmd", "/c","Start", "Run_program.bat",file_name_1_java);
            File dir = new File("C:\\Users\\Sherrinford\\Documents\\Github\\src\\batch");
            pb.directory(dir);
            Process p = pb.start();
        }
        catch (Exception e)
        {
            System.out.println("HEY Buddy ! U r Doing Something Wrong ");
            e.printStackTrace();
        }

        String output_string="";

        try (BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Sherrinford\\Documents\\Github\\src\\batch\\error_"+file_name_1_java+".txt"))) {

            String sCurrentLine;
            while ((sCurrentLine = br.readLine()) != null) {
                System.out.println(sCurrentLine);
                output_string+=sCurrentLine+"\n";
            }
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        try (BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Sherrinford\\Documents\\Github\\src\\batch\\output_"+file_name_1_java+".txt"))) {

            String sCurrentLine;
            while ((sCurrentLine = br.readLine()) != null) {
                System.out.println(sCurrentLine);
                output_string+=sCurrentLine+"\n";
            }
            Output.setText(output_string);
        }
        catch (IOException e) {
            e.printStackTrace();
        }

    }
}


sample.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.ListView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>

<AnchorPane prefHeight="629.0" prefWidth="878.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller">
   <children>
      <Label alignment="CENTER" layoutY="-2.0" prefHeight="58.0" prefWidth="219.0" style="-fx-background-color: #8395a7;" text="Existing Files will be displayed below" wrapText="true">
         <font>
            <Font name="System Bold" size="18.0" />
         </font>
      </Label>
      <Button layoutX="219.0" layoutY="-1.0" onAction="#refresh" prefHeight="58.0" prefWidth="98.0" style="-fx-background-color: green; -fx-text-fill: white;" text="Refresh">
         <font>
            <Font name="System Bold" size="14.0" />
         </font></Button>
      <ListView fx:id="filelist" layoutY="57.0" prefHeight="574.0" prefWidth="318.0" style="-fx-background-color: #34495e; -fx-text-fill: white;" />
      <Label layoutX="370.0" layoutY="176.0" prefHeight="48.0" prefWidth="354.0" text="Create New File -">
         <font> 
            <Font name="System Bold" size="27.0" />
         </font>
      </Label>
      <TextField fx:id="file_pro_name" layoutX="370.0" layoutY="244.0" prefHeight="32.0" prefWidth="258.0" promptText="Enter New File Name Here">
         <font>
            <Font size="16.0" />
         </font>
         <padding>
            <Insets bottom="2.0" left="6.0" right="2.0" top="2.0" />
         </padding>
      </TextField>
      <Label layoutX="638.0" layoutY="243.0" prefHeight="38.0" prefWidth="78.0" text=".java">
         <font>
            <Font size="22.0" />
         </font>
      </Label>
      <Button layoutX="370.0" layoutY="290.0" mnemonicParsing="false" onAction="#createnew" prefHeight="38.0" prefWidth="106.0" style="-fx-background-color: green; -fx-text-fill: white;" text="Create">
         <font>
            <Font name="System Bold" size="19.0" />
         </font>
      </Button>
      <Label fx:id="error_message" alignment="CENTER" layoutX="469.0" layoutY="340.0" prefHeight="58.0" prefWidth="318.0" style="-fx-text-fill: red;" text="ERROR" textAlignment="CENTER" visible="false" wrapText="true">
         <font>
            <Font name="sans-serif Bold" size="15.0" />
         </font>
      </Label>
      <Label alignment="CENTER" layoutX="469.0" layoutY="9.0" prefHeight="58.0" prefWidth="318.0" text="Jnotebook" textAlignment="CENTER" underline="true">
         <font>
            <Font name="System Bold" size="48.0" />
         </font>
      </Label>
      <Label alignment="CENTER" layoutX="585.0" layoutY="396.0" prefHeight="38.0" prefWidth="86.0" style="-fx-text-fill: red;" text="OR" textAlignment="CENTER">
         <font>
            <Font name="System Bold" size="24.0" />
         </font>
      </Label>
      <Label alignment="CENTER" layoutX="354.0" layoutY="465.0" prefHeight="38.0" prefWidth="504.0" text="Click on already existing file from the beside list" textAlignment="CENTER">
         <font>
            <Font name="System Bold" size="20.0" />
         </font>
      </Label>
   </children>
</AnchorPane>


main.java

package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{

        //dATABASE BLOCK
        try{
            Connection conn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\Sherrinford\\Documents\\Jnotebook\\testjava.db");
            Statement statement = conn.createStatement();
            try {
                statement.execute("Create Table file_Name (Address VARCHAR(100),Parent_file VARCHAR)");
            }
            catch(Exception e){
                System.out.println("Table already exits "+e);
            }
            statement.close();
            conn.close();
        }
        catch(SQLException e){
            System.out.println("Something Went Wrong!  "+e);
        }

        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        primaryStage.setTitle("Hello World");
        primaryStage.setScene(new Scene(root));
        primaryStage.show();
    }



    public static void main(String[] args) {

        launch(args);
    }
}


javafx.fxml.LoadException: 
/C:/Users/Sherrinford/Documents/Github/out/production/Jnotebook/sample/open.fxml:12

    at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2603)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3253)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3210)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3179)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3152)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3129)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3122)
    at sample.Controller.createnew(Controller.java:70)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
    at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1784)
    at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8863)
    at javafx.controls/javafx.scene.control.Button.fire(Button.java:200)
    at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:206)
    at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3876)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1300(Scene.java:3604)
    at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
    at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2613)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
    at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
    at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
    at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.NullPointerException
    at sample.openController.<init>(openController.java:20)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
    at java.base/java.lang.Class.newInstance(Class.java:558)
    at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:936)
    at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:980)
    at javafx.fxml/javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:227)
    at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:752)
    at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
    ... 66 more

0 个答案:

没有答案