GWT无法将背景图像添加到简单面板

GWT无法将背景图像添加到简单面板,gwt,Gwt,我有一个SimplePanel,我试图通过编程设置它的背景图像,但下面的方法不起作用。为什么? this.coverImage.getElement().getStyle().setBackgroundImage("images/veg.jpg"); 用于: 风格: .coverImage{ width:400px; background-color:#e5e5e5; background-repeat: no-repeat; height:190px; z-index:-

我有一个SimplePanel,我试图通过编程设置它的背景图像,但下面的方法不起作用。为什么?

this.coverImage.getElement().getStyle().setBackgroundImage("images/veg.jpg");
用于:

风格:

.coverImage{
  width:400px;
  background-color:#e5e5e5;
  background-repeat: no-repeat;
  height:190px;
  z-index:-1;
}
但是,添加背景图像:urlmages/veg.jpg是可行的。

您几乎可以得到它

this.coverImage.getElement().getStyle().setBackgroundImage("url('images/veg.jpg')");

呜呜呜呜呜呜呜呜-P