Creating objects of user defined classes with scene builder and javafx

64 Views Asked by At

I'm facing a really disturbing problem. I'm working on a simple chess project game using javafx and scene builder. I have created the board (without pieces) as 8×8 gridpane then I added 64 square with black and white colord as in chess board. All of the previous was done in using fxml file and a controller plus a main javafx class. Now I created a class for the knight so I can add the methods of its moves and apply oop concepts with this project. I want to create an istance of the class knight. and as it's javafx project I created it the instance in the controller class but I faced the following two problems.

1_ the knight is originally an imageview in the scene builder so I can't assign the name of the new created instance with scene builder.

2- how do I call those methods.so they are used to handle user events.

I'm not that fimilar with javafx so I haven't tried alot. I hope someone can guide me. put into consideration that this a learning project mostly focusing on building strong logic , diving deep with oop plus having some knowledge about javafx .

0

There are 0 best solutions below