I've started learning JavaFX for a personal project and things were going well until I hit an issue with creating a set of text fields. As far as I can tell, the code is correct and the IDE I'm using doesn't give any indication of an error. But when I attempt to run the program, it spits out a long list off errors that don't occur when I comment out the code creating the textfields. The program runs exactly as it should when those lines of code are left out.
I'm using InteliJ Idea, Windows 10, Javafx SDK 14.0.1, and Java JDK 14.0.1
I've included the code I'm using below. The program is extremely straight forward so I included all of it just in case I've overlooked something earlier on.
package library.test;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.shape.*;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class main extends Application {
@Override
public void start(Stage primaryStage) {
// Create the grid plane
GridPane pane =new GridPane();
pane.setHgap(10);
pane.setVgap(6);
pane.setAlignment(Pos.TOP_CENTER);
// Create the scene
Scene scene=new Scene(pane,500,500);
primaryStage.setScene(scene);
primaryStage.setTitle("Book Catalog");
primaryStage.show();
// Create the elements for the table
Text tTitle = new Text("Title");
Text tAuthor = new Text("Author");
Text tGenre = new Text("Genre");
Text tFormat = new Text("Format");
Text tISBN = new Text("ISBN");
TextField fTitle=new TextField();
TextField fAuthor=new TextField();
TextField fGenre=new TextField();
TextField fFormat=new TextField();
TextField fISBN =new TextField();
// Add the elements of the scene
pane.add(tTitle,1,1);
pane.add(tAuthor,3,1);
pane.add(tGenre,5,1);
pane.add(tFormat,7,1);
pane.add(tISBN,8,1);
pane.add(fTitle,2,3);
}
public static void main(String[] args) {
launch(args);
}
I'm extremely new to this side of programming so I apologize if I missed something obvious. Thanks in advance!
ADDITION
Included the stack trace
Exception in Application start method
java.lang.reflect.InvocationTargetException
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 javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
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 java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0x25c44106) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x25c44106
at com.sun.javafx.fxml.FXMLLoaderHelper.<clinit>(FXMLLoaderHelper.java:38)
at javafx.fxml.FXMLLoader.<clinit>(FXMLLoader.java:2056)
at sample.Main.start(Main.java:13)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
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:174)
... 1 more
Exception running application sample.Main