3

I try to render an image in a grid cell as follows:

grid.addColumn(probe ->
    new ThemeResource("img/" + probe.getStructureData().getImageFileName()),
    new ImageRenderer()
).setCaption("Structure");

I want to set the size of the image in pixel. How can I do this? It seems the ImageRenderer has no method for this. Of cause I could size my images before. But I would like to add a big image that should be shown as tooltip and a small version of the same image should be shown in the grid cell. I would like to avoid adding the same image in 2 sizes.

Thank you!

alfakini
  • 4,635
  • 2
  • 26
  • 35
Natalie
  • 445
  • 2
  • 5
  • 18

1 Answers1

2

Try doing it this way.

grid.addComponentColumn(probe -> {
    Image image = new Image("", new ThemeResource("img/" + probe.getStructureData().getImageFileName()));
    image.setWidth(100, Sizeable.Unit.PIXELS);
    image.setHeight(100, Sizeable.Unit.PIXELS);

    return image;
}).setCaption("Structure");
Dawid Fieluba
  • 1,271
  • 14
  • 34