Hi, I am trying to connect a pojo holding all the required xy coordinates, to a javafx scene graph, and cannot work out how to do this. It is a simple Javafx scene graph created with scenebuilder; a circle and three lines, and an exit button.
How do I connect the pojo holding with coords to javafx scene graph?
So far I have, all within a javafx enabled project in e(fx)clipse:
1) "classA": GeometryCalculator class, includes a member class object GeometryResultsObj
The output of classA is one instance of classB. This is in a for loop to run from 1-360 degrees, overwriting classB for each change.
2) "classB": GeometryResultsObj stores, the circle diameter, circle xy centre, 3 lines xy start & end coords
3) "classC": GeometryGraphic.java contains main() with launch() and start()
4) "classD": GeometryGraphic.fxml with a static circle and three lines (waiting to be animated)
5) "classE": GeometryGraphicController java class, contains initialize() and initData(classB coords).
ClassA is tested and calculates ok.
ClassB is correctly populated when classA is run.
ClassC when run, displays the scenegraph with circle & lines in their original positions, with no errors.
I've tried creating an initData method on the controller class which does a set on each fxml object with a get on the relevant pojo field. If I run the controller there is no classB of coordinates to read, but it runs ok, and displays the graphic with circle and lines in their initial positions.
To run the series of outputs to the scenegraph for 1-360 events, with a next button, so they can be visually checked for incorrect logic in classA. It would also be great to add a play button, with slow & fast slider to view a continously animated output.
The structure probably isn't quite right, as the driver is the ClassA. Driving from ClassC finds no ClassB with coordinate data. ClassA could be changed quite easily to create a result object per iteration (1-360) and add these to a collection.
Can you please advise how to link the graph to the coordinates, and how this should be restructured to enable this.
The nearest I can think of is calling the method in ClassA at the beginning of the controller classE's initData function?
I haven't included code as it would be a lot to post, even a cut down version. Advice on the correct approach & structure would be very much appreciated.
Yes, I posted it on stackexchange yesterday. I was unaware of the term cross posting, and the policy - apologies if that has offended anyone.
I haven't had a reply from either site. Are you able to help?
I find your question a bit specific and detailed for your particular case, so a detailed answer wouldn't be of much use to anybody else. It is also difficult for me to understand your requirements well enough to provide a good specific answer or advice on program structure.
I think there are some things you can study which may be related and may help you in your quest (from simpler to more complicated);