PDA

View Full Version : how to change the size of the text in a ToggleToolItem?



mwaschkowski
16 Jun 2008, 9:46 AM
I've tried a couple of things, but no workie:

homeItem = new ToggleToolItem();
homeItem.setStyleAttribute("font", "normal 18px tahoma");
homeItem.setStyleAttribute("x-btn-text", "normal 18px tahoma");
System.out.println("style=" + homeItem.getBaseStyle());

Calling getBaseStyle() returns null :(

Thanks,

Mark

assassin
17 Jun 2008, 12:49 AM
Maybe you can use:



homeItem.addStyleName("cssClass");
or
homeItem.addStyleDependentName("cssClass");
or
homeItem.setStylePrimaryName("cssClass"); For more information look at GWT Api class UIObject:
http://google-web-toolkit-doc-1-5.googlecode.com/svn/javadoc/1.5/index.html?overview-summary.html

mwaschkowski
17 Jun 2008, 4:21 AM
Ugh, didn't think this would be so tough. Ah well, here is what I tried with no success:

toolBar.addStyleName("bigText");
toolBar.setStyleAttribute("font-size", "21");
homeItem.addStyleName("bigText");
homeItem.setStyleAttribute("font-size", "21");

Help!

Thanks,

Mark

mwaschkowski
17 Jun 2008, 4:31 AM
Ugh, as well, can't seem to set a DataList to have a transparent background. I tried:
menuList.setStyleAttribute("background-color", "transparent");
menuItem.setStyleAttribute("background-color", "transparent");

Not sure if I'm missing something with regards to css handling or not...

mwaschkowski
17 Jun 2008, 6:21 AM
OK, realized that I have to use camelCase (not the css style names) to change the styles programmatically.

DataList can be updated like this:

list.setStyleAttribute("backgroundColor", "transparent");

However, with the following code I can change the background color, but not the font size:


homeItem.setStyleAttribute("fontSize", "21px");
homeItem.setStyleAttribute("backgroundColor", "red");

Any suggestions?

Thanks,

Mark

darrellmeyer
17 Jun 2008, 8:20 AM
setText is treated as HTML so you could do this:


item.setText("<span style='font-size: 12px'>GWT</span>");However, tab item will not render properly with a font size > 11px.

mwaschkowski
17 Jun 2008, 8:27 AM
OK, I won't go that route then, thanks for the info!