How does one dynamically change a textfield's visual properties, say background color?
An example might be during a validation to modify the background color dependent on the value entered.
In your war (this will be inside WebContent if you are using ecilpse) have a file in this path VAADIN/themes/customrunno/styles.css (asuming you are using runno as your theme)
With this content:
@import url(../runo/styles.css);
.my_bg_style {
background: #99EE6B;
}
In your init method:
setTheme("customruno"); // same as the folder folder under VAADIN/themes
change your textfield background:
textField.addStyleName("my_bg_style"); // same as in styles.css
to remove the style just do:
textField.removeStyleName("my_bg_style");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With