I am working with JavaFX2.0.I need to show the thumbnail images in listview.I am writing the code as below.
ObservableList<BufferedImage> imageList = FXCollections.observableArrayList();
try {
for (int i = 1; i <= pdf.getPageCount(); i++) {
BufferedImage pageImage = pdf.getPageAsImage(i);
imageList.add(pageImage);
} catch (PdfException e) {
_logger.error("Error :" + e.getMessage());
}
thumbnailsList.setItems(imageList);
Here thumbnailsList is the fx:id of the listview.But if i use this code i am getting image object and not an image.Can any one tell me that how can i get the image in listview.
Thank You.
You could use a sample from
http://docs.oracle.com/javafx/2/ui_controls/list-view.htm
which is called "Example 11-4 Creating a Cell Factory".
You have to set custom cell factory. And instead of
Rectangle
, put anImageView
there.