I am trying to load my computer folder images into a wall of thumnails. I read from the previous thread from this forum that ImageView "url" instance varable does not support system paths. I tried with the solution there, but it will cause an java.lang.OutOfMemoryError: Java heap space as it keeps reading the file.

another problem is it keeps giving me warning of using package javafx.ext --->SwingUtils.toFXImage method.


I have also tried to input the URL to be as below
url: "file://localhost//Users/user/Pictures/Camera/test/1.JPG"
i tried display 20 times of the image, it only display a randomly 3 or 4 image only when i run my app. THe images will displayed to be empty boxes that create to store them

i check with the error function given from ImageView, it does not indicate any of my images encountered an error.


Is there any other alternatives?

really need help on this. have been trying for days.


Codes
Java FX Code:
function load() {
println("RUNTIME {Runtime.getRuntime().maxMemory()}");
System.gc();
Runtime.getRuntime().freeMemory();

//MAC Folder PATH
var path: String = "/Users/username/Pictures/camera/test/1.JPG";;
var file: File = new File(path);
//http://download.oracle.com/docs/cd/E17802_01/javafx/javafx/1.3/docs/api/javafx.ext.swing/javafx.ext.swing.SwingUtils.html
//public toFXImage(image: java.awt.image.BufferedImage) : Image
//Creates a JavaFX Image from a BufferedImage.
img = SwingUtils.toFXImage(ImageIO.read(file));
}