On Sep 23, 10:36 am, Kurcob <[email protected]> wrote:
> Hi Guys,
>
> so, in fact i have a problem with the PushButton and HTML elements.
> I try something like this:
>
> String text = "Hello World";
> String label = "<b>"  + text+ "</b>";
> PushButton b = new PushButton();
> b.setText(new HTML(l).toString());

Wow! new HTML(l).toString() ?!

> ....
>
> Browser Result:
> <b>Hello World</b>
>
> But i just want to see the text in bold style, but not with the HTML
> tags.
>
> So, knows anybody about a workaround or is there just no possibility
> to style text in a PushButton?

Just use setHTML instead of setText:
b.setHTML("<b>Hello world</b>");

But really, if all you want is bold text, you'd rather make a CSS rule
with a class selector and addStyleName() it:
CSS:
   .myButton { font-weight: bold; }
Java:
   b.addStyleName("myButton");
or if you want *all* your buttons to have a bold face, just
define .gwt-PushButton to be bold:
   .gwt-PushButton { font-weight: bold; }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to