I don't know how to debug this, and I've used two different books and online resources. My code won't even run and I don't get why it won't start as a windowed application. Source below the error.
The stack trace:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
My code:
import javafx.stage.Window;
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public abstract class window extends Application {
public void main( String args[]) {
Stage primaryStage = null;
FlowPane pane = new FlowPane();
pane.setPadding(new Insets(10));
pane.setMaxHeight(1080);
pane.setMaxWidth(1920);
pane.setHgap(5);
pane.setVgap(5);
pane.getChildren().addAll(new Button("Initiate Virtual Reality"),
new TextField(), new Label("Enter Response"), new Button("Send "
+ "Response") );
Scene scene = new Scene(pane, 720, 1280);
primaryStage.setTitle("Hello World! Goodbye!"); //Make evil statement
primaryStage.setScene(scene); //Place scene in the stage
primaryStage.show(); //Display the stage
Application.launch(args);
}
}