This is the error.
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724)
    at javafx.base@19-ea/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base@19-ea/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
    at javafx.base@19-ea/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base@19-ea/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base@19-ea/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base@19-ea/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19-ea/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19-ea/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19-ea/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19-ea/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19-ea/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base@19-ea/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.base@19-ea/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics@19-ea/javafx.scene.Node.fireEvent(Node.java:8797)
    at javafx.controls@19-ea/javafx.scene.control.Button.fire(Button.java:203)
    at javafx.controls@19-ea/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:208)
    at javafx.controls@19-ea/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
    at javafx.base@19-ea/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
    at javafx.base@19-ea/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at javafx.base@19-ea/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
    at javafx.base@19-ea/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base@19-ea/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base@19-ea/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base@19-ea/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19-ea/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19-ea/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19-ea/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19-ea/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19-ea/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base@19-ea/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base@19-ea/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics@19-ea/javafx.scene.Scene$MouseHandler.process(Scene.java:3881)
    at javafx.graphics@19-ea/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
    at javafx.graphics@19-ea/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2607)
    at javafx.graphics@19-ea/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
    at javafx.graphics@19-ea/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at javafx.graphics@19-ea/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
    at javafx.graphics@19-ea/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
    at javafx.graphics@19-ea/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
    at javafx.graphics@19-ea/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
    at javafx.graphics@19-ea/com.sun.glass.ui.View.notifyMouse(View.java:937)
    at javafx.graphics@19-ea/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics@19-ea/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:77)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at javafx.base@19-ea/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml@19-ea/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:84)
    at javafx.fxml@19-ea/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1852)
    ... 46 more
Caused by: java.lang.NumberFormatException: For input string: ""
    at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
    at java.base/java.lang.Integer.parseInt(Integer.java:675)
    at java.base/java.lang.Integer.valueOf(Integer.java:992)
    at com.example.studentdatabase/com.example.studentdatabase.Register.register(Register.java:99)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    ... 53 more
These are my classes and FXMLs
Main class -
package com.example.studentdatabase;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
public class Main extends Application {
    InputStream stream = new FileInputStream("C:\\Users\\dinira francisco\\Desktop\\DDSlogo.jpg");
    Image image  = new Image(stream);
    public Main() throws FileNotFoundException {
    }
    @Override
    public void start(Stage stage) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("Register.fxml"));
        Scene scene = new Scene(fxmlLoader.load());
        stage.setTitle("Student Database 2023");
        stage.getIcons().add(image);
        stage.setResizable(false);
        stage.setScene(scene);
        stage.show();
    }
    public static void main(String[] args) {
        launch();
    }
}
// type here
Register class -
package com.example.studentdatabase;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.Statement;
public class Register {
    private int studentID=0;
    private boolean hasFirstName = false;
    private boolean hasLastName = false;
    private boolean hasAge = false;
    private boolean hasGrade = false;
    @FXML
    private TextField GradeTF;
    @FXML
    private Button ageSubmit;
    @FXML
    private TextField ageTF;
    @FXML
    private TextField firstNameTF;
    @FXML
    private Button firstSubmit;
    @FXML
    private Button gradeSubmit;
    @FXML
    private TextField lastNameTF;
    @FXML
    private Button lastsubmit;
    @FXML
    private Button registerButton;
    @FXML
    private Label warning;
    public void getFirstName(ActionEvent event){
        if(firstNameTF.getText().length()>=1){
            hasFirstName=true;
            firstNameTF.setDisable(true);
        }
    }
    public void getLastName(ActionEvent event){
        if(lastNameTF.getText().length()>=1){
            hasLastName=true;
            lastNameTF.setDisable(true);
        }
    }
    public void getAge(ActionEvent event){
        if(ageTF.getText().length()>=1){
            hasAge=true;
            ageTF.setDisable(true);
        }
    }
    public void getGrade(ActionEvent event){
        if(GradeTF.getText().length()>=1){
            hasGrade=true;
            GradeTF.setDisable(true);
        }
    }
    public void register(ActionEvent event){
        if(hasFirstName && hasLastName && hasAge && hasGrade){
            studentID++;
            warning.setText("Registration Completed!");
            warning.setVisible(true);
            firstNameTF.setText("");
            lastNameTF.setText("");
            ageTF.setText("");
            GradeTF.setText("");
            firstNameTF.setDisable(false);
            lastNameTF.setDisable(false);
            ageTF.setDisable(false);
            GradeTF.setDisable(false);
            hasFirstName=false;
            hasLastName = false;
            hasAge = false;
            hasGrade = false;
            DatabaseConnection databaseConnection = new DatabaseConnection();
            Connection connection = databaseConnection.getConnection();
            String registerString = "INSERT INTO student_data(student_id,first_name,last_name,age,grade) VALUES('"+studentID+"','"+firstNameTF.getText()+"','"+lastNameTF.getText()+"','"+Integer.valueOf(ageTF.getText())+"','"+Integer.valueOf(GradeTF.getText())+"')";
            try{
                Statement statement = connection.createStatement();
                statement.executeUpdate(registerString);
            }catch(Exception e){
                e.printStackTrace();
                e.getCause();
            }
        }else{
            warning.setText("Fields are Empty!");
            warning.setVisible(true);
        }
    }
}
Database Connection class -
package com.example.studentdatabase;
import java.sql.Connection;
import java.sql.DriverManager;
public class DatabaseConnection {
    public Connection databaseLink;
    public Connection getConnection(){
        String databaseName = "student_db";
        String databaseUser = "root";
        String databasePassword = "***";
        String url = "jdbc:mysql://localhost/"+databaseName;
        try{
            Class.forName("com.mysql.cj.jdbc.Driver");
            databaseLink = DriverManager.getConnection(url,databaseUser,databasePassword);
        }catch (Exception e){
            e.printStackTrace();
            e.getCause();
        }
        return databaseLink;
    }
}
and FXML -
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="443.0" prefWidth="458.0" style="-fx-background-color: #f0db24;" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.studentdatabase.Register">
   <children>
      <Label layoutX="161.0" layoutY="25.0" text="Student Database">
         <font>
            <Font size="17.0" />
         </font>
      </Label>
      <Label layoutX="95.0" layoutY="52.0" text="Sinhala Oratory & Debating Society">
         <font>
            <Font size="17.0" />
         </font>
      </Label>
      <Label layoutX="106.0" layoutY="78.0" text="D.S.Senanayake College - Col. 08">
         <font>
            <Font size="17.0" />
         </font>
      </Label>
      <Label layoutX="161.0" layoutY="125.0" text="Registration Form">
         <font>
            <Font size="17.0" />
         </font>
      </Label>
      <Label layoutX="66.0" layoutY="177.0" text="First Name ">
         <font>
            <Font size="15.0" />
         </font>
      </Label>
      <Label layoutX="67.0" layoutY="226.0" text="Last Name ">
         <font>
            <Font size="15.0" />
         </font>
      </Label>
      <Label layoutX="66.0" layoutY="269.0" text="Age">
         <font>
            <Font size="15.0" />
         </font>
      </Label>
      <Label layoutX="66.0" layoutY="315.0" text="Grade">
         <font>
            <Font size="15.0" />
         </font>
      </Label>
      <TextField fx:id="firstNameTF" layoutX="154.0" layoutY="175.0" />
      <TextField fx:id="lastNameTF" layoutX="154.0" layoutY="224.0" />
      <TextField fx:id="ageTF" layoutX="154.0" layoutY="267.0" />
      <TextField fx:id="GradeTF" layoutX="154.0" layoutY="313.0" />
      <Button fx:id="firstSubmit" layoutX="318.0" layoutY="175.0" mnemonicParsing="false" onAction="#getFirstName" text="Submit" />
      <Button fx:id="gradeSubmit" layoutX="318.0" layoutY="313.0" mnemonicParsing="false" onAction="#getGrade" text="Submit" />
      <Button fx:id="ageSubmit" layoutX="318.0" layoutY="267.0" mnemonicParsing="false" onAction="#getAge" text="Submit" />
      <Button fx:id="lastsubmit" layoutX="318.0" layoutY="224.0" mnemonicParsing="false" onAction="#getLastName" text="Submit" />
      <Button fx:id="registerButton" layoutX="192.0" layoutY="358.0" mnemonicParsing="false" onAction="#register" text="Register" />
      <Label fx:id="warning" layoutX="175.0" layoutY="399.0" text="Fields are Empty!" textFill="#f70909" visible="false" />
   </children>
</AnchorPane>
I searched some solutions in stackoverflow but couldn't solve the issue.