A Set of imagefiles are added to an arraylist(filelist2) of type File.Then an imageview and a button are affffded to a vbox,such vboxes are added to a grids of a gripane using a
Consider using a java.util.HashMap and calling hashMap.get(actionEvent.getSource()).getName() to get the file name.
java.util.HashMap
hashMap.get(actionEvent.getSource()).getName()