Images and Icons Flashcards

1
Q

Image Component

A

The Image component allows you to embed images. It’s a wrapper around the HTML <img></img> element. You can display either static images or images generated on the fly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Image Static Resources

A

A servlet container can serve images as static resources. This is more efficient than streaming them through the application, as described later. You can also serve static resources from a frontend server.

Image image = new Image(“images/myimage.png”, “My Alt Image”);
add(image);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Image Stream Resources

A

You can use StreamResource to load images from the Java class path. In this case, the images need to be below src/main/resources in the Java compilation path. The path for getResourceAsStream() is relative to that path. You need to include the leading /.

StreamResource imageResource = new StreamResource(“myimage.png”,
() -> getClass().getResourceAsStream(“/images/myimage.png”));

Image image = new Image(imageResource, “My Streamed Image”);
add(image);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Icons

A

Icons are small graphical symbols intended to represent the various functions of an application, as well as different types of data. Vaadin has over 600 built-in icons for you to use in your applications.
Icon icon = new Icon(“vaadin”, “moon”);
add(icon);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly