Hello guys, I'm in the middle of creating a small program. I'm a bit of a noob when it comes to programming and I just starting playing with the NetBeans GUI builder to help out a friend with his code. So far what happens is:
1. JFrame pops up with a non-editable text field, button, JList, and empty panel.
2. User clicks button, and it prompts them to select a directory.
3. Once the user selects the directory, the program will load all files from this folder (eventually I'll set it to only allow .jpg).
4. The program will then display the directory in the text field and place the names of these files in the JList.
PROBLEM:
I'm having trouble with 4. I've been trying forever to get this thing to run. I've gotten it to display the directory correctly. But I can't seem to get the JList to load the file names from a file array. Here's some code if anyone can help.
*NOTE*: I have already declared a DefaulListModel named listModel outside of this buttons action event. The code isn't generating any errors but the JList remains empty after I click load.
text field -> directory
button -> jButton1
file chooser -> fc
string array of file names -> fileNames
file array of -> selectedFiles
JList -> fileList
Thanks in advance!