How to set a border on a Vaadin component?

appshare.co picture appshare.co · Apr 8, 2011 · Viewed 15.3k times · Source

I would like to programmatically set a border around a Form component in Java. How can I do this without having to edit the css style sheet?

Answer

Jouni picture Jouni · Apr 11, 2011

You could wrap the form with a Panel component, which has a border defined already. Otherwise, not much alternatives than just using CSS.

One option, if you wish to stay inside the server environment, is to use the CSSInject add-on and add the border using that (you still need to write CSS, but you can do it on the server in a Java file and not inside a regular CSS file).