-1

Second Question,

I use IntelliJIdEA and Vaadin Designer, i add a img to a VerticalLayout out an tryed to have the Img as a kind of a Header, but it will not appear on the localhost side.

the image is created from the Designer

@Id("img")
    private Image img;

And i ve tryed to connect

 Image i = new Image("frontend/turkey-5201498_1920.jpg", "Alternative image text");
        i.setSizeFull();
        img.add(i);

Doesnt worked, i´ve connected a button Clicklistener this was working

i place the jpg in the project folder /folder/file.jpg

Thank you for the help in front !

1 Answers1

0

Where you should place your static files and how you refer to them depends a little on what tools you have in your chain. If you are using the default recommended stack with Spring boot, then your image should be in /src/main/resources/META-INF/resources/img/turkey-5201498_1920.jpg and you should refer to it as new Image("img/turkey-5201498_1920.jpg", "Alternative image text")

For non-Spring Boot apps, and for more details, check this awesome reply in another Stack Overflow question. https://stackoverflow.com/a/57553974/64095

Jens Jansson
  • 4,626
  • 4
  • 25
  • 29