I am new to Java and Jfreechart, and i want to design a Java program that can do data visualizion, when you open a file (with openFileChooser) it draws a line Chart automatically on the jPanel. For this program, i write 3 Java files, one for the GUI (GUI.java), one for the data parsing (Loader.java) and one for presenting the data (Painter.java).
The openFileChooser should pass the file path to the Loader.java, so it can parsing the data and stores the data in an Arraylist mData, then this Arraylist should be passed to Painter.java to draw.
But i am confused, i thought the enter Point of the whole program is GUI.java, it Initials all the component and uses the Event handler to call other Java files?
But where should i put the codes that passes the file path to the Loader.java? Should i put it in the Event handler of openFileChooser or just put it in the Painter.java?
The following codes are the codes i have Trouble to allocate to:
java.io.File file = openFileChooser.getSelectedFile();
String filepath = file.getAbsolutePath();
Loader fileLoader = new Loader();
mData = fileLoader.parseSchlupfi(filepath);