I found this piece of code, but it won't run a new blank window and keep getting NullPointerException error. p.s. I'm new to programming. Any help would be appreciated thanks.
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
BorderPane root = new BorderPane();
try {
Scene scene = new Scene(root,640,480);
scene.getStylesheets().add(getClass().getResource("/application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
root.setCenter(new RootLayout());
}
public static void main(String[] args) {
launch(args);
}
}