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

+10 votes
asked in CSC 305 Fall 2024 by (1.3k points)

1 Answer

+4 votes

So, for FileChoosers, you have to do a couple things.
First, you make the object:

variableName = new FileChooser();

Then, you have to add extension filters. Extension filters are what the fileChooser will be looking for, so if you need images and you DON'T have the extension filter for the image files, it won't show up.
An image extension filter should look something like this:
newExtensionFilter("Image Files", ".png", ".jpg", "*.gif")

You also have to add a file object for it to load the file, otherwise the file you are choosing is going nowhere.

Hope this helps!

answered by (868 points)
...