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, thesilv...@gmail.com 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);
lblGreenLabel.setStyleName("gwt-Label.Green");
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment