Custom image as background for panel or window

Hi,
Im trying to figure out how I could put a image as background for a Panel,
I dont want to mess with CSS stuff, mainly since I want the user to be able to replace the image, so question is how do I go about to do that ?
I would be happy for now If I could just load a image using ThemeResource or similar and then do a “panel.setBackground( ., )”.

Or do I have to inherit Panel and replace paint with some stuff ? if that is the case is there any example of doing so ?

BR
Matias

Without CSS? Short answer is you don’t. Serving dynamic content (such as images stored in a database) can be done with the various Resource classes in combination with Embedded, but there is no way to alter a background image without CSS in Vaadin.

Now, setting a (statically served, e.g. from theme) background image with CSS is very easy, and there are a lot of examples of this available. If you want to serve the image dynamically, though… I think you best bet is to create an extended Panel component, and even that might not work. It really depends on where you store the image and how you serve it from the servlet (or if you use a servlet for this at all). Details of your setup would make it easier for me to recommend a solution.