How to load an image to java application assets folder

630 Views Asked by At

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

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

After that, image should be visible in image control.

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

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

1

There are 1 best solutions below

0
Marek Bardoński On BEST ANSWER

This is solution, created after discussion [1]

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