Search code examples
javajava-web-startnifty-gui

How to load an image to java application assets folder


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?


Solution

  • This is solution, created after discussion [1]

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