0

i wrote css for a button its working fine in GWT designer and it showing the image. but when i compile and run its not showing the image . and i tried getElement().getStyle() but no use i tried DOM.setStyleAttribute(btnNewButton.getElement(), "background", "url(../WEB-INF/btn.jpg)"); no use

please help me with this..

here's my css

.cancel {
    background-repeat: no-repeat;

    background-image: url( ../WEB-INF/btnCancel.jpg);

}

code..

Button btnNewButton = new Button("New button");

btnNewButton.setStyleName("cancelbutton");

btnNewButton.setText("cancel");

i am using GWT 2.4

Jama A.
  • 15,680
  • 10
  • 55
  • 88
GLN
  • 161
  • 3
  • 14

2 Answers2

2

Don't put files in the WEB-INF folder if you want to access them in a web page. The folder is not accessible.

Hilbrand Bouwkamp
  • 13,509
  • 1
  • 45
  • 52
  • Thanks... for your help ..found the solution...created new images folder and i placed all my images ther..now its working..problem is am not getting that button function..like when i press button will go down right.. – GLN Mar 08 '12 at 11:43
  • Not sure what you mean, but guessing you want different images for different buttons states (like when down, different image). In that case take a look at PushButton, where you can set different state images. – Hilbrand Bouwkamp Mar 08 '12 at 12:12
0

Try using quotes in css.

background-image: url('../WEB-INF/btnCancel.jpg');

Should be a good matter. And make sure the image is not called 'btnCancel.JPG'.

Almaron
  • 4,127
  • 6
  • 26
  • 48
  • But WEB-INF is not accessible in Browser. Also there is no problem with the quotes even if it is a Normal HTML Application. – Vijay Sarin Mar 08 '12 at 07:45