2

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.

rupa
  • 241
  • 2
  • 8
  • 19

1 Answers1

3

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 an ImageView there.

sigod
  • 3,514
  • 2
  • 21
  • 44
Alexander Kirov
  • 3,624
  • 1
  • 19
  • 23