KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to load my computer folder images into a wall of thumbnails. I read on a thread from another forum that ImageView "url" instance variable does not support system paths. I tried with the solution there, but it throws an exception: 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 like that: "file://localhost//Users/USER/Pictures/Camera/test/1.JPG" I tried to display a number of images, but it always only displays 3 to 4 images. I checked with the error function given from ImageView , it does not indicate that the reading of my images encountered an error. Are there any alternatives? 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)); }
Tags (comma-separated)
Save Edits
Cancel