Problem CSS Label In CustomComponent

Hi , Im new in vaadin and this is my first question , hope somebody can help me
I have a UI Class Named

public class EEE extends UI {

   private Navigator navigator;

   @WebServlet(value = "/*", asyncSupported = true)
   @VaadinServletConfiguration(productionMode = false, ui = DDC.class)
   public static class Servlet extends VaadinServlet {


   protected void init(VaadinRequest request) {

         navigator = new Navigator(this, this);
         navigator.addView(Funcion1.NAME, new Funcion1());


[/code]And in the class Funcion1 i use Vaadin User Interface

public class Funcion1 extends CustomComponent implements View { ……… } . Everything is okey except , that I can put CSS in a Label “total” the field StyleName I put my theme . like this

Image1 In Attachment

I have my CSS File
Image 2 Attachment


@import “…/reindeer/legacy-styles.css”;

.v-label {

   background-color: red;

[/code] it doesn’t work , my question is this .

If I put mytheme in Label StyleName doesn’t work
If I put @Theme(“mytheme”) in Funcion1 doesn’t work .
But if I put @Theme(“mytheme”´) in EEE who call Funcion 1 , my CSS works !
So , Can I put CSS in Class extend CustomComponent ? or in a Style Name field and I am doing something wrong ? , I said this because I need several theme , like
Funcion1 mytheme
Funcion2 mytheme2 like this.

Sorry for my English
Thanks !


Theme is associated with UI, so if you want to customize style you have to name your style marker and add definition into ui theme:

Label label = new Label(....);
.v-label .my-custom-label {
       background-color: red;

That needs to be in order to work (no space between the class selectors). They are targeting the same element, so they need to be combined.

Thanks with the space didn’t work and now yes !