Pagination JavaFX分页-更新当前页面的内容

Pagination JavaFX分页-更新当前页面的内容,pagination,task,javafx-8,Pagination,Task,Javafx 8,在我的JavaFX应用程序中,我使用分页来显示一些图片。阅读图片需要花费很多时间,因此我在可观察列表中填入占位符图像,加载时应将其替换为原始图像 一切正常,但唯一的问题是当前页面在加载图像时不会得到更新。我必须更改CurrentPageIndex,然后再更改回去。此时将显示右侧的图片。 为了加载图像,我创建了一个任务,以便在此过程中使用应用程序。 所以我的问题是,如何更新当前页面的内容 页面工厂看起来是这样的: ImageView imageView = new ImageView();

在我的JavaFX应用程序中,我使用
分页
来显示一些图片。阅读图片需要花费很多时间,因此我在
可观察列表中填入占位符图像,加载时应将其替换为原始图像
一切正常,但唯一的问题是当前页面在加载图像时不会得到更新。我必须更改
CurrentPageIndex
,然后再更改回去。此时将显示右侧的图片。
为了加载图像,我创建了一个
任务
,以便在此过程中使用应用程序。

所以我的问题是,如何更新当前页面的内容 页面工厂看起来是这样的:

    ImageView imageView = new ImageView();
    Image img = images.get(index);
    imageView.setImage(img);
    imageView.setFitWidth(240);
    imageView.setStyle("-fx-background-color: white");
    imageView.setPreserveRatio(true);
    imageView.setSmooth(true);
    imageView.setCache(true);
    imageView.setEffect(createShadow(Color.BLACK, false));
    VBox pageBox = new VBox();
    pageBox.setAlignment(Pos.CENTER);
    pageBox.getChildren().add(imageView);
    return pageBox;


这里我替换图像(前两行是框架的方法):

for(int i=0;i
    for (int i = 0; i < pageCount; i++) {
        PagePainter pp = parser.getPagePainter(i);
        BufferedImage buffImg = pp.getImage(200);
        fxImages.set(i, SwingFXUtils.toFXImage(buffImg, null));
    }