致力于在 JavaFX 中创建图像库.无法正确显示图像
问题描述
我正在使用 javafx 创建图片库.我在互联网上找到了很多关于此的内容,但无法针对此问题获得任何合适的帮助.我必须创建一个图片库,例如 picasa 查看器.所有图像都在我的图像视图中的缩略图视图中,然后当我选择弹出查看器中的图像时.我为此做了一些代码,但没有得到正确的输出.文件夹中的所有图像都从相同的坐标重绘.下面是我的代码和输出.
I am creating image gallery using javafx. I found many things on internet regarding this but not able to get any suitable help for this issue. I have to create one image gallery like picasa viewer. all the images is in thumbnail view in my image view and after that when I select image that is in pop-up viewer. I did it some code for that but I didn't get proper output. All the images from the folder redraw from the same co-ordinates. Below is my code and output.
请帮助我解决我的问题.我想将图像一张一张地显示为缩略图视图.
kindly help me to resolve my issue. I want to display images one by one as thumbnail view.
推荐答案
您需要创建一个 TilePane 并将 ImageView 添加到其中.如果需要,您可以使用 ScrollPane.双击创建全屏预览的完整示例如下所示.您当然可以为创建 FXML 进行必要的更改 :)
You need to create a TilePane and add the ImageView's to it. You can have a ScrollPane if needed. A complete example with double click to create a fullscreen preview is shown below. You can of course do necessary changes for creating a FXML :)
输出
这在您调整窗口大小时非常有用,如果需要,可以使 ScrollPane 可见.
这篇关于致力于在 JavaFX 中创建图像库.无法正确显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!