private void loadImageFilenames() {
        
        String fileEndings[] = {"JPEG","JPG","jpeg","jpg","png","PNG"};
         
        File images = new File(sdir);
        ArrayList<String> imgArray = new ArrayList<String>();
        for(String name : images.list()) {
        	if(name.split("\\.").length > 1) {
        		for (int i = 0; i < fileEndings.length; i++) {
        	        if(name.split("\\.")[1].equals(fileEndings[i])) {
        		        imgArray.add(name);
        	        }
        		}
        	}
        }
        int imgArraySize = 0;
        boolean end = false;
        try {
            while(end == false) {
                listModel.addElement(imgArray.get(imgArraySize));
                imgArraySize++;
            }
        }
        catch (IndexOutOfBoundsException ex0) {
            end = true;
        }
       
        sampleImagesList.setModel(listModel);
        sampleImagesList.setSelectedIndex(0);   
    }