Search code examples
javaxmlgwtuibinder

Changing the background color of textbox java UiBinder


I want to change the background color of a textbox as an indicator that it is being validated.

<ui:style>     

   .textBoxColor
   {
        background-color: #FF6EB4;  
}
</ui:style>

and then

if(firstName.equals(""))
    {

        txtFirstName.setStyleName("textBoxColor");
    }

This is however not giving the expected result.

How can I achieve the change in color?

Kind regards


Solution

  • If I'm not mistaken, css names declared in UIBinder are converted on compilation - so setting the style to textBoxColor won't work, simply because there won't be a style with that name.

    If you add that to an external css file (maybe with a more descriptive name, say... .validated), setStyleName() will work.