1

I want to set a custom background for all my Buttons in my GWT app. I'm using the standard GWT Button class. So ( As recommended by one of the guys in SO ) in my CSS file I have

.gwt-Button
{
background-color: red;
}

However this does not get applied to my Button. Then I tried

myButton.setStyleName("gwt-Button");

Same result. I then changed the name of the style to "gwt.Button1" , set this as my style name and hey presto it works. So investigating why I couldn't modify the inbuilt CSS style I noticed that when I compiled my GWT project ( I'm using Eclipse ) that in my WAR folder there is a folder created called war/myModule/gwt/standard and in this folder are CSS files which contain the default GWT styles. ( At least that's my take on it ) So my question is how do I apply my own styling to gwt-Button and why are these css files being put in this folder and can I change these?

MayoMan
  • 4,757
  • 10
  • 53
  • 85

2 Answers2

2

I think the below link should solve your problem

GWT theme style overrides my css style

If not revert back. Cheers :)

Community
  • 1
  • 1
Abhijith Nagaraja
  • 3,370
  • 6
  • 27
  • 55
1
Project --->
|
Src
|
package com.xxxxx
|
|
folder(resources(any))
|
|
css(folder)
|
|
YourcssFile.css(write your css here )

Refer :https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCss#cssfiles

And in GWT.xml file

<stylesheet src='css/YourcssFile.css' />
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307