Wednesday, January 30, 2013

Re: Why doesn't applying styles to labels work?

I don't think you can use the dot (.) in the middle like that.  Try setting your style to something like ".gwt-Label-Green" or something similar.  

On Wednesday, January 30, 2013 6:00:09 AM UTC-8, wrote:
I want to apply styles to labels such as color, boldness, alignment and whatnot.  This doesn't seem to work.  Consider the following code:
public class StyleTest implements EntryPoint
private final AbsolutePanel absolutePanel = new AbsolutePanel();
private final Label lblNormalLabel = new Label("Normal Label");
private final Label lblGreenLabel = new Label("Green Label");

public void onModuleLoad()
RootPanel rootPanel = RootPanel.get();
rootPanel.add(absolutePanel, 10, 10);
absolutePanel.setSize("430px", "280px");
absolutePanel.add(lblNormalLabel, 30, 24);
absolutePanel.add(lblGreenLabel, 30, 82);
lblGreenLabel.setSize("141px", "36px");

and the CSS entry:
.gwt-Label.Green {
color: Green;
font-size: larger;
font-weight: bolder;
vertical-align: middle;

I would expect lblGreenLabel to be green, centered, larger and bolded.  However it is identical to lblNormalLabel in appearance.  What am I doing wrong or how do I get lblGreenLabel to accept the styles I want?

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment