我正在努力通过改变它的颜色使内容面板的标题看起来像闪烁。但我正在尝试的代码不起作用,这里是代码:
public class Reminder extends ContentPanel{
Timer time = new Timer{
public void run(){
rpc.getReminders(new AsyncCallBack<ArrayList<ModelData>>(){
public voidonFailure(Throwable caught)
{ }
public void onSuccess(ArrayList<ModelData> result){
//the next line does not affect any result
getHeader().setStyleAttribute("backgroundColor","red");
//even tried throught css, but both of them gave no result
getHeader().addStyleName("myredpanel");
//But this method is working, but its also overwriting the parents css styles, but i only need to change backgroun color
getHeader().setStyleName("myredpanel");
})
搜索论坛,但这些例子不适用于我的论坛?还有什么建议?
答案 0 :(得分:1)
致电setStyleAttribute
时,请勿使用驼峰案例名称。
getHeader().setStyleAttribute("backgroundColor","red"); // WRONG
getHeader().setStyleAttribute("background-color","red"); // CORRECT
答案 1 :(得分:0)
如果您使用的是gxt 3.0.X,则应更改ContentPanelAppereance,直接样式设置可能没有帮助。如果你愿意,我可以发一个例子。