Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+16 votes

I'm able to read the csv file, however, I am having trouble figuring out how I would be able to make it so the image can get displayed straight from the csv file rather than manually inputting the images into graphics

asked in CSC305 Fall 2023 by (1 point)

3 Answers

+7 votes

Your question really has nothing to do with CSV files.

Once you have the image name (String) taken from the CSV file, the next step is to find the right relative path to the image file, including the folder name, etc.

Then if you have that path, your question is how to load/display an image in JavaFX from a given file path.

This question might help, although there are different approaches depending on how you want to display the image in the UI.

https://lovelace.augustana.edu/q2a/index.php/7241/image-in-javafx

answered by (4.2k points)
+5 votes

Here is a quick tip, so once u have the file name .png name from the CSv you can read the dir that holds the img files too and just put that URL of the dir/.pn(tht u read from the csv) into the image view or what ever view u are using

answered by (1 point)
+4 votes

Also, you can directly read the dir that holds the graphs and get the list of the names of the files and do something with that name i.e URL

answered by (1 point)
...