Skip to content
Advertisement

how to add an object in java lang to the fxml file

im trying to make a game I have made a grid of cells in a java class and another part of the UI in the fxml file but when I run it ide gives:

JavaFX Application Thread” java.lang.RuntimeException: java.lang.reflect.InvocationTargetException and points out to the array containg the cells once and many time to the constructor plz help

here is the usergrid class containing the cells class mouse gesture and actual grid note that mouse gesture class is not complete as I`m trying to solve this

JavaScript

here is the fxml file I`ve made some buttons then tried to add the actualgrid to the stackpane with fx:id of grid root

JavaScript

here is the way I tried to call the grid note tha there is some try catch blocks as I`m trying to determine the cause of the problem

JavaScript

here is the data model class for containing the data

JavaScript

and the css file used to design the code

JavaScript

and here is the complete stack trace the first three line is just a check`

JavaScript

Advertisement

Answer

Yes, James_D get the point. I tested your code and with a few tweaks it worked. Look:

Main.java

JavaScript

DataModel.java

JavaScript

UserGrid.java (fixing StackOverflow Exception)

JavaScript

InitializerPageController.java

JavaScript

GridInitializer.fxml

JavaScript

userGrid.css

JavaScript

And finally the project structure

Project structure.

Hope it helps!

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement