2013-05-31 41 views

回答

4

这里是样品

.v-textfield-dashing  
{  
    border:  thin dashed;  
    background: white; /* Has shading image by default */  
} 

的详细信息,你会得到这个链接。 https://vaadin.com/book/-/page/components.textfield.html

如果你想改变文本框颜色动态,那么你会得到下面的链接 https://vaadin.com/wiki/-/wiki/Main/Dynamically%20injecting%20CSS

+1

而不是注入CSS,您可以使用addStyleName()添加另一个CSS类或removeStyleName()以将其删除 –

3

在你的战争的内容(这将是内部的WebContent如果您正在使用ecilpse)有一个文件,此路径VAADIN /主题/ customrunno/Styles.css中(asuming您使用runno为您的主题)

有了这个内容:

@import url(../runo/styles.css); 

.my_bg_style { 
    background: #99EE6B; 
} 

在你的init方法具d:

setTheme("customruno"); // same as the folder folder under VAADIN/themes 

改变你的文本框的背景:

textField.addStyleName("my_bg_style"); // same as in styles.css 

删除的样式只是做:

textField.removeStyleName("my_bg_style");