如何将图像加载到java应用程序资源文件夹

时间:2021-05-18 00:26:24

I'm going to make a java application with nifty-gui[1] using java web start

我将使用java web start使用nifty-gui [1]创建一个java应用程序

When user click on upload image, a file chooser is showed (FileOpenService)

当用户点击上传图片时,会显示文件选择器(FileOpenService)

After that, image should be visible in image control.

之后,图像应该在图像控制中可见。

Unfortunately, nifty-gui can use images only from assets.

不幸的是,nifty-gui只能使用来自资产的图像。

How to download this image into asset? Maybe there is a way to modify actual image using data from FileContent class?

如何将此图像下载到资产?也许有一种方法可以使用FileContent类中的数据修改实际图像?

1 个解决方案

#1


0  

This is solution, created after discussion [1]

这是解决方案,经过讨论后创建[1]

assetManager.registerLoader(AWTLoader.class, "jpg");
assetManager.registerLocator("/", FileLocator.class);
            image(new ImageBuilder() {{
                filename("/home/marek/photo2.jpg");
            }});

#1


0  

This is solution, created after discussion [1]

这是解决方案,经过讨论后创建[1]

assetManager.registerLoader(AWTLoader.class, "jpg");
assetManager.registerLocator("/", FileLocator.class);
            image(new ImageBuilder() {{
                filename("/home/marek/photo2.jpg");
            }});